aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.in26
-rwxr-xr-xconfigure3
-rw-r--r--configure.ac1
-rw-r--r--game/fonts/Bold/Font 1024 Bold 16.png (renamed from game/resources/fonts/Bold/Font 1024 Bold 16.png)bin36542 -> 36542 bytes
-rw-r--r--game/fonts/Bold/Font 1024 Bold.dat (renamed from game/resources/fonts/Bold/Font 1024 Bold.dat)bin256 -> 256 bytes
-rw-r--r--game/fonts/Bold/eurostar_regular_bold.dat (renamed from game/resources/fonts/Bold/eurostar_regular_bold.dat)bin256 -> 256 bytes
-rw-r--r--game/fonts/Bold/eurostar_regular_bold.png (renamed from game/resources/fonts/Bold/eurostar_regular_bold.png)bin84067 -> 84067 bytes
-rw-r--r--game/fonts/Normal/eurostar_regular.dat (renamed from game/resources/fonts/Normal/eurostar_regular.dat)bin256 -> 256 bytes
-rw-r--r--game/fonts/Normal/eurostar_regular.png (renamed from game/resources/fonts/Normal/eurostar_regular.png)bin59609 -> 59609 bytes
-rw-r--r--game/fonts/Outline 1/Outline 1.dat (renamed from game/resources/fonts/Outline 1/Outline 1.dat)bin256 -> 256 bytes
-rw-r--r--game/fonts/Outline 1/Outline 1.png (renamed from game/resources/fonts/Outline 1/Outline 1.png)bin74739 -> 74739 bytes
-rw-r--r--game/fonts/Outline 2/Outline 2.dat (renamed from game/resources/fonts/Outline 2/Outline 2.dat)bin256 -> 256 bytes
-rw-r--r--game/fonts/Outline 2/Outline 2.png (renamed from game/resources/fonts/Outline 2/Outline 2.png)bin106020 -> 106020 bytes
-rwxr-xr-xgame/fonts/fonts.ini11
-rw-r--r--icons/rccompile-delphi.bat2
-rw-r--r--icons/rccompile-fpc.bat4
-rw-r--r--icons/readme.txt20
-rw-r--r--icons/ultrastardx-icon.rc1
-rw-r--r--icons/ultrastardx-icon.resbin0 -> 22748 bytes
-rw-r--r--icons/ultrastardx-icon_32.pngbin0 -> 666 bytes
-rw-r--r--icons/ultrastardx-icon_512.png (renamed from artwork/usdx_icon_512.png)bin106731 -> 106731 bytes
-rw-r--r--src/Makefile.in27
-rw-r--r--src/base/TextGL.pas93
-rw-r--r--src/base/UCommon.pas101
-rw-r--r--src/base/UMain.pas4
-rw-r--r--src/macosx/MacResources.pas126
-rw-r--r--src/rccompile-delphi.bat1
-rw-r--r--src/rccompile-fpc.bat3
-rw-r--r--src/resource.inc27
-rw-r--r--src/ultrastardx.dpr2
-rw-r--r--src/ultrastardx.rc38
31 files changed, 186 insertions, 304 deletions
diff --git a/Makefile.in b/Makefile.in
index 15ce3f3b..7dd84313 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -80,7 +80,7 @@ USE_PROJECTM_CWRAPPER = @USE_PROJECTM_CWRAPPER@
# Dependencies
#################################################
-DEPS := $(USDX_TOOLS_DIR)/ResourceExtractor
+DEPS :=
ifeq ($(USE_PROJECTM_CWRAPPER), yes)
DEPS += $(PROJECTM_CWRAPPER_DIR)
endif
@@ -223,20 +223,23 @@ install-exec:
.PHONY: install-data
install-data:
$(MAKE) RECURSIVE_SRC_DIR="artwork" \
- RECURSIVE_DST_DIR="$(DESTDIR)$(INSTALL_DATADIR)/artwork" \
- install-data-recursive
+ RECURSIVE_DST_DIR="$(DESTDIR)$(INSTALL_DATADIR)/artwork" \
+ install-data-recursive
$(MAKE) RECURSIVE_SRC_DIR="$(USDX_GAME_DIR)/languages" \
- RECURSIVE_DST_DIR="$(DESTDIR)$(INSTALL_DATADIR)/languages" \
- install-data-recursive
+ RECURSIVE_DST_DIR="$(DESTDIR)$(INSTALL_DATADIR)/languages" \
+ install-data-recursive
$(MAKE) RECURSIVE_SRC_DIR="$(USDX_GAME_DIR)/sounds" \
- RECURSIVE_DST_DIR="$(DESTDIR)$(INSTALL_DATADIR)/sounds" \
- install-data-recursive
+ RECURSIVE_DST_DIR="$(DESTDIR)$(INSTALL_DATADIR)/sounds" \
+ install-data-recursive
$(MAKE) RECURSIVE_SRC_DIR="$(USDX_GAME_DIR)/themes" \
- RECURSIVE_DST_DIR="$(DESTDIR)$(INSTALL_DATADIR)/themes" \
- install-data-recursive
+ RECURSIVE_DST_DIR="$(DESTDIR)$(INSTALL_DATADIR)/themes" \
+ install-data-recursive
+ $(MAKE) RECURSIVE_SRC_DIR="$(USDX_GAME_DIR)/fonts" \
+ RECURSIVE_DST_DIR="$(DESTDIR)$(INSTALL_DATADIR)/fonts" \
+ install-data-recursive
$(MAKE) RECURSIVE_SRC_DIR="$(USDX_GAME_DIR)/resources" \
- RECURSIVE_DST_DIR="$(DESTDIR)$(INSTALL_DATADIR)/resources" \
- install-data-recursive
+ RECURSIVE_DST_DIR="$(DESTDIR)$(INSTALL_DATADIR)/resources" \
+ install-data-recursive
$(INSTALL_DATA) "COPYING.txt" "$(DESTDIR)$(INSTALL_DATADIR)/COPYING.txt"
.PHONY: install-data-recursive
@@ -270,6 +273,7 @@ uninstall-data:
$(RM_REC) "$(DESTDIR)$(INSTALL_DATADIR)/languages"
$(RM_REC) "$(DESTDIR)$(INSTALL_DATADIR)/sounds"
$(RM_REC) "$(DESTDIR)$(INSTALL_DATADIR)/themes"
+ $(RM_REC) "$(DESTDIR)$(INSTALL_DATADIR)/fonts"
$(RM_REC) "$(DESTDIR)$(INSTALL_DATADIR)/resources"
$(RM) "$(DESTDIR)$(INSTALL_DATADIR)/COPYING.txt"
-rmdir "$(DESTDIR)$(INSTALL_DATADIR)"
diff --git a/configure b/configure
index 1608c6e5..aa40f065 100755
--- a/configure
+++ b/configure
@@ -6203,8 +6203,6 @@ if [ x$libprojectM_USE_CWRAPPER = xyes ]; then
ac_config_files="$ac_config_files src/lib/projectM/cwrapper/Makefile"
fi
-ac_config_files="$ac_config_files tools/ResourceExtractor/Makefile"
-
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -6812,7 +6810,6 @@ do
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
"src/config-$FPC_PLATFORM.inc") CONFIG_FILES="$CONFIG_FILES src/config-$FPC_PLATFORM.inc:src/config.inc.in" ;;
"src/lib/projectM/cwrapper/Makefile") CONFIG_FILES="$CONFIG_FILES src/lib/projectM/cwrapper/Makefile" ;;
- "tools/ResourceExtractor/Makefile") CONFIG_FILES="$CONFIG_FILES tools/ResourceExtractor/Makefile" ;;
*) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
diff --git a/configure.ac b/configure.ac
index 9201a86a..8229210c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -236,7 +236,6 @@ AC_CONFIG_FILES([src/config-$FPC_PLATFORM.inc:src/config.inc.in])
if [[ x$libprojectM_USE_CWRAPPER = xyes ]]; then
AC_CONFIG_FILES([src/lib/projectM/cwrapper/Makefile])
fi
-AC_CONFIG_FILES([tools/ResourceExtractor/Makefile])
AC_OUTPUT
# -----------------------------------------
diff --git a/game/resources/fonts/Bold/Font 1024 Bold 16.png b/game/fonts/Bold/Font 1024 Bold 16.png
index dc4f28e6..dc4f28e6 100644
--- a/game/resources/fonts/Bold/Font 1024 Bold 16.png
+++ b/game/fonts/Bold/Font 1024 Bold 16.png
Binary files differ
diff --git a/game/resources/fonts/Bold/Font 1024 Bold.dat b/game/fonts/Bold/Font 1024 Bold.dat
index ea9f2484..ea9f2484 100644
--- a/game/resources/fonts/Bold/Font 1024 Bold.dat
+++ b/game/fonts/Bold/Font 1024 Bold.dat
Binary files differ
diff --git a/game/resources/fonts/Bold/eurostar_regular_bold.dat b/game/fonts/Bold/eurostar_regular_bold.dat
index 1b2023e2..1b2023e2 100644
--- a/game/resources/fonts/Bold/eurostar_regular_bold.dat
+++ b/game/fonts/Bold/eurostar_regular_bold.dat
Binary files differ
diff --git a/game/resources/fonts/Bold/eurostar_regular_bold.png b/game/fonts/Bold/eurostar_regular_bold.png
index f2732e44..f2732e44 100644
--- a/game/resources/fonts/Bold/eurostar_regular_bold.png
+++ b/game/fonts/Bold/eurostar_regular_bold.png
Binary files differ
diff --git a/game/resources/fonts/Normal/eurostar_regular.dat b/game/fonts/Normal/eurostar_regular.dat
index f44ae7d8..f44ae7d8 100644
--- a/game/resources/fonts/Normal/eurostar_regular.dat
+++ b/game/fonts/Normal/eurostar_regular.dat
Binary files differ
diff --git a/game/resources/fonts/Normal/eurostar_regular.png b/game/fonts/Normal/eurostar_regular.png
index 21ef5ac4..21ef5ac4 100644
--- a/game/resources/fonts/Normal/eurostar_regular.png
+++ b/game/fonts/Normal/eurostar_regular.png
Binary files differ
diff --git a/game/resources/fonts/Outline 1/Outline 1.dat b/game/fonts/Outline 1/Outline 1.dat
index ea9f2484..ea9f2484 100644
--- a/game/resources/fonts/Outline 1/Outline 1.dat
+++ b/game/fonts/Outline 1/Outline 1.dat
Binary files differ
diff --git a/game/resources/fonts/Outline 1/Outline 1.png b/game/fonts/Outline 1/Outline 1.png
index a1af3cd2..a1af3cd2 100644
--- a/game/resources/fonts/Outline 1/Outline 1.png
+++ b/game/fonts/Outline 1/Outline 1.png
Binary files differ
diff --git a/game/resources/fonts/Outline 2/Outline 2.dat b/game/fonts/Outline 2/Outline 2.dat
index 062f1629..062f1629 100644
--- a/game/resources/fonts/Outline 2/Outline 2.dat
+++ b/game/fonts/Outline 2/Outline 2.dat
Binary files differ
diff --git a/game/resources/fonts/Outline 2/Outline 2.png b/game/fonts/Outline 2/Outline 2.png
index 9677d379..9677d379 100644
--- a/game/resources/fonts/Outline 2/Outline 2.png
+++ b/game/fonts/Outline 2/Outline 2.png
Binary files differ
diff --git a/game/fonts/fonts.ini b/game/fonts/fonts.ini
new file mode 100755
index 00000000..9f934c66
--- /dev/null
+++ b/game/fonts/fonts.ini
@@ -0,0 +1,11 @@
+[Normal]
+File=Normal/eurostar_regulr.png
+
+[Bold]
+File=Bold/eurostar_regular_bold.png
+
+[Outline1]
+File=Outline 1/Outline 1.png
+
+[Outline2]
+File=Outline 2/Outline 2.png \ No newline at end of file
diff --git a/icons/rccompile-delphi.bat b/icons/rccompile-delphi.bat
new file mode 100644
index 00000000..32f209a7
--- /dev/null
+++ b/icons/rccompile-delphi.bat
@@ -0,0 +1,2 @@
+@set RES_NAME=ultrastardx-icon
+BRC32 -r -fo%RES_NAME%.res %RES_NAME%.rc
diff --git a/icons/rccompile-fpc.bat b/icons/rccompile-fpc.bat
new file mode 100644
index 00000000..30998c6d
--- /dev/null
+++ b/icons/rccompile-fpc.bat
@@ -0,0 +1,4 @@
+@set PATH=C:\Programme\lazarus\fpc\2.2.0\bin\i386-win32\;%PATH%
+@set RES_NAME=ultrastardx-icon
+windres.exe -i %RES_NAME%.rc -o %RES_NAME%.res
+
diff --git a/icons/readme.txt b/icons/readme.txt
new file mode 100644
index 00000000..f75a99f4
--- /dev/null
+++ b/icons/readme.txt
@@ -0,0 +1,20 @@
+Resource files (.rc/.res) are needed for MS Windows builds only.
+
+The .res file is the compiled version of .rc and appended to the
+executable. It is just used to provide an icon for the executable
+that is shown in the explorer.
+
+Delphi does the compilation of the .rc to .res file automatically.
+FPC needs windres (delivered with FPC) for ths purpose but windres
+must be started separately.
+
+You can manually run the compilation process with either
+ rccompile-delphi.bat or
+ rccompile-fpc.bat
+depending on the available compiler (delphi/windres files are compatible).
+
+If FPC is used, the path to the FPC bin-dir might have to be adjusted,
+the default is "PATH=C:\Programme\lazarus\fpc\2.2.0\bin\i386-win32\".
+
+To avoid the need to run the resource-compiler, a pre-compiled .res-file
+was added to SVN. Please commit the res-file if the rc-file was changed. \ No newline at end of file
diff --git a/icons/ultrastardx-icon.rc b/icons/ultrastardx-icon.rc
new file mode 100644
index 00000000..3d0b43fc
--- /dev/null
+++ b/icons/ultrastardx-icon.rc
@@ -0,0 +1 @@
+MAINICON ICON "ultrastardx.ico"
diff --git a/icons/ultrastardx-icon.res b/icons/ultrastardx-icon.res
new file mode 100644
index 00000000..d79a3d0f
--- /dev/null
+++ b/icons/ultrastardx-icon.res
Binary files differ
diff --git a/icons/ultrastardx-icon_32.png b/icons/ultrastardx-icon_32.png
new file mode 100644
index 00000000..1b13a6ee
--- /dev/null
+++ b/icons/ultrastardx-icon_32.png
Binary files differ
diff --git a/artwork/usdx_icon_512.png b/icons/ultrastardx-icon_512.png
index d02ec89c..d02ec89c 100644
--- a/artwork/usdx_icon_512.png
+++ b/icons/ultrastardx-icon_512.png
Binary files differ
diff --git a/src/Makefile.in b/src/Makefile.in
index 33bf8fba..3d4b6def 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -52,17 +52,6 @@ USDX_LIB_DIR := $(USDX_SRC_DIR)/lib
INSTALL_DATADIR := $(datadir)/$(USDX_PACKAGE_NAME)
#################################################
-# RC -> resource.inc
-#################################################
-
-# RC resource extraction config
-RESEXTRACTOR_DIR := $(USDX_TOOLS_DIR)/ResourceExtractor
-RESEXTRACTOR_BIN := $(RESEXTRACTOR_DIR)/ResourceExtractor$(EXEEXT)
-RESOURCE_DIR := $(USDX_GAME_DIR)/resources
-RESOURCE_FILE := $(srcdir)/resource.inc
-RC_FILE := $(srcdir)/ultrastardx.rc
-
-#################################################
# FPC config
#################################################
@@ -230,7 +219,7 @@ create-pathinfo:
echo "INSTALL_DATADIR = '$(INSTALL_DATADIR)';" > paths.inc
# check if any src-file changed and rebuild
-$(USDX_BIN): $(RESOURCE_FILE) $(USDX_PROJ) $(STATIC_LIBS) $(SRC_FILES)
+$(USDX_BIN): $(USDX_PROJ) $(STATIC_LIBS) $(SRC_FILES)
@echo "==================================="
@echo "Changed files:"
@echo "$?"
@@ -247,25 +236,13 @@ $(USDX_BIN): $(RESOURCE_FILE) $(USDX_PROJ) $(STATIC_LIBS) $(SRC_FILES)
$(PPC) $(strip $(PFLAGS_ALL)) -o$@ $(USDX_PROJ)
#################################################
-# Resource-file
-#################################################
-
-$(RESOURCE_FILE): $(RC_FILE)
- $(RESEXTRACTOR_BIN) $(RC_FILE) $(RESOURCE_DIR) $(RESOURCE_FILE)
-
-
-#################################################
# clean-up
#################################################
.PHONY: clean
-clean: clean_obj clean_res
+clean: clean_obj
$(RM) paths.inc
-.PHONY: clean_res
-clean_res:
- $(RM) "$(RESOURCE_FILE)"
-
.PHONY: clean_obj
clean_obj: clean_bin
$(RM_REC) "$(PCUNIT_DIR)"
diff --git a/src/base/TextGL.pas b/src/base/TextGL.pas
index f7b3ac95..f02a261c 100644
--- a/src/base/TextGL.pas
+++ b/src/base/TextGL.pas
@@ -12,7 +12,6 @@ uses
gl,
SDL,
UTexture,
- Classes,
// SDL_ttf,
ULog;
@@ -73,81 +72,101 @@ uses
UMain,
UCommon,
SysUtils,
+ IniFiles,
+ Classes,
UGraphic;
var
// Colours for the reflection
TempColor: array[0..3] of GLfloat;
-procedure LoadBitmapFontInfo(aID : integer; const aType, aResourceName: string);
+{**
+ * Load font info.
+ * FontFile is the name of the image (.png) not the data (.dat) file
+ *}
+procedure LoadFontInfo(FontID: integer; const FontFile: string);
var
- stream: TStream;
+ Stream: TFileStream;
+ DatFile: string;
begin
- stream := GetResourceStream(aResourceName, aType);
- if (not assigned(stream)) then
- begin
- Log.LogError('Unknown font['+ inttostr(aID) +': '+aType+']', 'loadfont');
- Exit;
- end;
+ DatFile := ChangeFileExt(FontFile, '.dat');
+ FillChar(Fonts[FontID].Width[0], Length(Fonts[FontID].Width), 0);
+
+ Stream := nil;
try
- stream.Read(Fonts[ aID ].Width, 256);
+ Stream := TFileStream.Create(DatFile, fmOpenRead);
+ Stream.Read(Fonts[FontID].Width, 256);
except
- Log.LogError('Error while reading font['+ inttostr(aID) +': '+aType+']', 'loadfont');
+ Log.LogError('Error while reading font['+ inttostr(FontID) +']', 'LoadFontInfo');
end;
- stream.Free;
+ Stream.Free;
end;
// Builds bitmap fonts
procedure BuildFont;
var
Count: integer;
+ FontIni: TMemIniFile;
+ FontFile: string; // filename of the image (with .png/... ending)
begin
ActFont := 0;
- SetLength(Fonts, 5);
- Fonts[0].Tex := Texture.LoadTexture(true, 'Font', TEXTURE_TYPE_TRANSPARENT, 0);
+ SetLength(Fonts, 4);
+ FontIni := TMemIniFile.Create(FontPath + 'fonts.ini');
+
+ // Normal
+
+ FontFile := FontPath + FontIni.ReadString('Normal', 'File', '');
+
+ Fonts[0].Tex := Texture.LoadTexture(true, FontFile, TEXTURE_TYPE_TRANSPARENT, 0);
Fonts[0].Tex.H := 30;
Fonts[0].AspectW := 0.9;
Fonts[0].Outline := 0;
- Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', TEXTURE_TYPE_TRANSPARENT, 0);
+ LoadFontInfo(0, FontFile);
+
+ // Bold
+
+ FontFile := FontPath + FontIni.ReadString('Bold', 'File', '');
+
+ Fonts[1].Tex := Texture.LoadTexture(true, FontFile, TEXTURE_TYPE_TRANSPARENT, 0);
Fonts[1].Tex.H := 30;
Fonts[1].AspectW := 1;
Fonts[1].Outline := 0;
- Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', TEXTURE_TYPE_TRANSPARENT, 0);
+ LoadFontInfo(1, FontFile);
+ for Count := 0 to 255 do
+ Fonts[1].Width[Count] := Fonts[1].Width[Count] div 2;
+
+ // Outline1
+
+ FontFile := FontPath + FontIni.ReadString('Outline1', 'File', '');
+
+ Fonts[2].Tex := Texture.LoadTexture(true, FontFile, TEXTURE_TYPE_TRANSPARENT, 0);
Fonts[2].Tex.H := 30;
Fonts[2].AspectW := 0.95;
Fonts[2].Outline := 5;
- Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', TEXTURE_TYPE_TRANSPARENT, 0);
- Fonts[3].Tex.H := 30;
- Fonts[3].AspectW := 0.95;
- Fonts[3].Outline := 4;
+ LoadFontInfo(2, FontFile);
+ for Count := 0 to 255 do
+ Fonts[2].Width[Count] := Fonts[2].Width[Count] div 2 + 2;
-{ Fonts[4].Tex := Texture.LoadTexture('FontO', TEXTURE_TYPE_TRANSPARENT, 0); // for score screen
- Fonts[4].Tex.H := 30;
- Fonts[4].AspectW := 0.95;
- Fonts[4].Done := -1;
- Fonts[4].Outline := 5;}
+ // Outline2
- // load font info
- LoadBitmapFontInfo( 0, 'FNT', 'Font');
- LoadBitmapFontInfo( 1, 'FNT', 'FontB');
- LoadBitmapFontInfo( 2, 'FNT', 'FontO');
- LoadBitmapFontInfo( 3, 'FNT', 'FontO2');
+ FontFile := FontPath + FontIni.ReadString('Outline2', 'File', '');
- for Count := 0 to 255 do
- Fonts[1].Width[Count] := Fonts[1].Width[Count] div 2;
-
- for Count := 0 to 255 do
- Fonts[2].Width[Count] := Fonts[2].Width[Count] div 2 + 2;
+ Fonts[3].Tex := Texture.LoadTexture(true, FontFile, TEXTURE_TYPE_TRANSPARENT, 0);
+ Fonts[3].Tex.H := 30;
+ Fonts[3].AspectW := 0.95;
+ Fonts[3].Outline := 4;
+ LoadFontInfo(3, FontFile);
for Count := 0 to 255 do
Fonts[3].Width[Count] := Fonts[3].Width[Count] + 1;
-{ for Count := 0 to 255 do
- Fonts[4].Width[Count] := Fonts[4].Width[Count] div 2 + 2;}
+
+ // close ini-file
+ FontIni.Free;
// enable blending by default
for Count := 0 to High(Fonts) do
diff --git a/src/base/UCommon.pas b/src/base/UCommon.pas
index 38a68d84..3f41dae6 100644
--- a/src/base/UCommon.pas
+++ b/src/base/UCommon.pas
@@ -306,87 +306,74 @@ begin
end;
-{$IFDEF Unix}
- // include resource-file info (stored in the constant array "resources")
- {$I ../resource.inc}
-{$ENDIF}
+// include resource-file info (stored in the constant array "resources")
+{$I ../resource.inc}
function GetResourceStream(const aName, aType: string): TStream;
-{$IFDEF Unix}
var
ResIndex: integer;
Filename: string;
-{$ENDIF}
begin
Result := nil;
- {$IFDEF Unix}
for ResIndex := 0 to High(resources) do
begin
- if (resources[ResIndex][0] = aName ) and
- (resources[ResIndex][1] = aType ) then
+ if (Resources[ResIndex][0] = aName ) then
begin
try
- Filename := ResourcesPath + resources[ResIndex][2];
+ Filename := ResourcesPath + Resources[ResIndex][1];
Result := TFileStream.Create(Filename, fmOpenRead);
except
- Log.LogError('Failed to open: "'+ resources[ResIndex][2] +'"', 'GetResourceStream');
+ Log.LogError('Failed to open: "'+ resources[ResIndex][1] +'"', 'GetResourceStream');
end;
- exit;
+ Exit;
end;
end;
- {$ELSE}
- try
- Result := TResourceStream.Create(HInstance, aName , PChar(aType));
- except
- Log.LogError('Invalid resource: "'+ aType + ':' + aName +'"', 'GetResourceStream');
- end;
- {$ENDIF}
end;
// +++++++++++++++++++++ helpers for RWOpsFromStream() +++++++++++++++
- function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl;
- var
- stream : TStream;
- origin : Word;
- begin
- stream := TStream( context.unknown );
- if ( stream = nil ) then
- raise EInvalidContainer.Create( 'SDLStreamSeek on nil' );
- case whence of
- 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0.
- 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset.
- 2 : origin := soFromEnd;
- else
- origin := soFromBeginning; // just in case
- end;
- Result := stream.Seek( offset, origin );
+function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl;
+var
+ stream : TStream;
+ origin : Word;
+begin
+ stream := TStream( context.unknown );
+ if ( stream = nil ) then
+ raise EInvalidContainer.Create( 'SDLStreamSeek on nil' );
+ case whence of
+ 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0.
+ 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset.
+ 2 : origin := soFromEnd;
+ else
+ origin := soFromBeginning; // just in case
end;
+ Result := stream.Seek( offset, origin );
+end;
- function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl;
- var
- stream : TStream;
- begin
- stream := TStream( context.unknown );
- if ( stream = nil ) then
- raise EInvalidContainer.Create( 'SDLStreamRead on nil' );
- try
- Result := stream.read( Ptr^, Size * maxnum ) div size;
- except
- Result := -1;
- end;
+function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl;
+var
+ stream : TStream;
+begin
+ stream := TStream( context.unknown );
+ if ( stream = nil ) then
+ raise EInvalidContainer.Create( 'SDLStreamRead on nil' );
+ try
+ Result := stream.read( Ptr^, Size * maxnum ) div size;
+ except
+ Result := -1;
end;
+end;
- function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl;
- var
- stream : TStream;
- begin
- stream := TStream( context.unknown );
- if ( stream = nil ) then
- raise EInvalidContainer.Create( 'SDLStreamClose on nil' );
- stream.Free;
- Result := 1;
- end;
+function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl;
+var
+ stream : TStream;
+begin
+ stream := TStream( context.unknown );
+ if ( stream = nil ) then
+ raise EInvalidContainer.Create( 'SDLStreamClose on nil' );
+ stream.Free;
+ Result := 1;
+end;
// -----------------------------------------------
(*
diff --git a/src/base/UMain.pas b/src/base/UMain.pas
index f9f56c3e..7d9886b6 100644
--- a/src/base/UMain.pas
+++ b/src/base/UMain.pas
@@ -77,6 +77,7 @@ var
LanguagesPath: string;
PluginPath: string;
VisualsPath: string;
+ FontPath: string;
ResourcesPath: string;
PlayListPath: string;
@@ -100,7 +101,7 @@ function FindPath(out PathResult: string; const RequestedPath: string; NeedsWrit
procedure InitializePaths;
procedure AddSongPath(const Path: string);
-Procedure Main;
+procedure Main;
procedure MainLoop;
procedure CheckEvents;
procedure Sing(Screen: TScreenSing);
@@ -1091,6 +1092,7 @@ begin
FindPath(LanguagesPath, Platform.GetGameSharedPath + 'languages', false);
FindPath(PluginPath, Platform.GetGameSharedPath + 'plugins', false);
FindPath(VisualsPath, Platform.GetGameSharedPath + 'visuals', false);
+ FindPath(FontPath, Platform.GetGameSharedPath + 'fonts', false);
FindPath(ResourcesPath, Platform.GetGameSharedPath + 'resources', false);
// Playlists are not shared as we need one directory to write too
diff --git a/src/macosx/MacResources.pas b/src/macosx/MacResources.pas
deleted file mode 100644
index fa67ad23..00000000
--- a/src/macosx/MacResources.pas
+++ /dev/null
@@ -1,126 +0,0 @@
-unit MacResources;
-
-{$I switches.inc}
-
-interface
-
-uses
- Classes, Windows, SysUtils;
-
-type
-
- TResourceStream = class(TFileStream)
- private
- public
- constructor Create(Instance: THandle; const ResName: String; ResType: PChar);
- end;
-
-function FindResource(hInstance: THandle; pcIdentifier: PChar; pcResType: PChar): THandle;
-
-implementation
-
-function FindResource(hInstance : THandle; pcIdentifier: PChar; pcResType: PChar): THandle;
-begin
- Result := 1;
-end;
-
-function GetResourcesPath : String;
-var
- i, j: Integer;
-begin
- Result := ExtractFilePath(ParamStr(0));
- for j := 0 to 2 do
- begin
- i := Length(Result);
- repeat
- Delete(Result, i, 1);
- i := Length(Result);
- until (i = 0) or (Result[i] = '/');
- end;
-end;
-
-{ TResourceStream }
-
-constructor TResourceStream.Create(Instance: THandle; const ResName: String; ResType: PChar);
-var
- sResNameLower: String;
- sFileName: String;
-begin
- sResNameLower := LowerCase(String(ResName));
-
- if ResType = 'TEX' then
- begin
- if sResNameLower = 'font' then
- sFileName := GetResourcesPath + 'Fonts/Normal/eurostar_regular.png'
- else if sResNameLower = 'fontb' then
- sFileName := GetResourcesPath + 'Fonts/Bold/eurostar_regular_bold.png'
- else if sResNameLower = 'fonto' then
- sFileName := GetResourcesPath + 'Fonts/Outline 1/Outline 1.png'
- else if sResNameLower = 'fonto2' then
- sFileName := GetResourcesPath + 'Fonts/Outline 2/Outline 2.png'
- else if sResNameLower = 'crdts_bg' then
- sFileName := GetResourcesPath + 'Graphics/credits_v5_bg.png'
- else if sResNameLower = 'crdts_ovl' then
- sFileName := GetResourcesPath + 'Graphics/credits_v5_overlay.png'
- else if sResNameLower = 'crdts_blindguard' then
- sFileName := GetResourcesPath + 'Graphics/names_blindguard.png'
- else if sResNameLower = 'crdts_blindy' then
- sFileName := GetResourcesPath + 'Graphics/names_blindy.png'
- else if sResNameLower = 'crdts_canni' then
- sFileName := GetResourcesPath + 'Graphics/names_canni.png'
- else if sResNameLower = 'crdts_commandio' then
- sFileName := GetResourcesPath + 'Graphics/names_commandio.png'
- else if sResNameLower = 'crdts_lazyjoker' then
- sFileName := GetResourcesPath + 'Graphics/names_lazyjoker.png'
- else if sResNameLower = 'crdts_mog' then
- sFileName := GetResourcesPath + 'Graphics/names_mog.png'
- else if sResNameLower = 'crdts_mota' then
- sFileName := GetResourcesPath + 'Graphics/names_mota.png'
- else if sResNameLower = 'crdts_skillmaster' then
- sFileName := GetResourcesPath + 'Graphics/names_skillmaster.png'
- else if sResNameLower = 'crdts_whiteshark' then
- sFileName := GetResourcesPath + 'Graphics/names_whiteshark.png'
- else if sResNameLower = 'intro_l01' then
- sFileName := GetResourcesPath + 'Graphics/intro-l-01.png'
- else if sResNameLower = 'intro_l02' then
- sFileName := GetResourcesPath + 'Graphics/intro-l-02.png'
- else if sResNameLower = 'intro_l03' then
- sFileName := GetResourcesPath + 'Graphics/intro-l-03.png'
- else if sResNameLower = 'intro_l04' then
- sFileName := GetResourcesPath + 'Graphics/intro-l-04.png'
- else if sResNameLower = 'intro_l05' then
- sFileName := GetResourcesPath + 'Graphics/intro-l-05.png'
- else if sResNameLower = 'intro_l06' then
- sFileName := GetResourcesPath + 'Graphics/intro-l-06.png'
- else if sResNameLower = 'intro_l07' then
- sFileName := GetResourcesPath + 'Graphics/intro-l-07.png'
- else if sResNameLower = 'intro_l08' then
- sFileName := GetResourcesPath + 'Graphics/intro-l-08.png'
- else if sResNameLower = 'intro_l09' then
- sFileName := GetResourcesPath + 'Graphics/intro-l-09.png'
- else if sResNameLower = 'outro_bg' then
- sFileName := GetResourcesPath + 'Graphics/outro-bg.png'
- else if sResNameLower = 'outro_esc' then
- sFileName := GetResourcesPath + 'Graphics/outro-esc.png'
- else if sResNameLower = 'outro_exd' then
- sFileName := GetResourcesPath + 'Graphics/outro-exit-dark.png';
- end
- else if ResType = 'FNT' then
- begin
- if sResNameLower = 'font' then
- sFileName := GetResourcesPath + 'Fonts/Normal/eurostar_regular.dat'
- else if sResNameLower = 'fontb' then
- sFileName := GetResourcesPath + 'Fonts/Bold/eurostar_regular_bold.dat'
- else if sResNameLower = 'fonto' then
- sFileName := GetResourcesPath + 'Fonts/Outline 1/Outline 1.dat'
- else if sResNameLower = 'fonto2' then
- sFileName := GetResourcesPath + 'Fonts/Outline 2/Outline 2.dat';
- end;
-
- if FileExists(sFileName) then
- inherited Create(sFileName, fmOpenReadWrite)
- else
- raise Exception.Create('MacResources.TResourceStream.Create: File "' + sFileName + '" not found.');
-end;
-
-end.
diff --git a/src/rccompile-delphi.bat b/src/rccompile-delphi.bat
deleted file mode 100644
index cd69530a..00000000
--- a/src/rccompile-delphi.bat
+++ /dev/null
@@ -1 +0,0 @@
-BRC32 -r -foultrastardx.res ultrastardx.rc
diff --git a/src/rccompile-fpc.bat b/src/rccompile-fpc.bat
deleted file mode 100644
index d7823d4a..00000000
--- a/src/rccompile-fpc.bat
+++ /dev/null
@@ -1,3 +0,0 @@
-@set PATH=C:\Programme\lazarus\fpc\2.2.0\bin\i386-win32\;%PATH%
-windres.exe -i ultrastardx.rc -o ultrastardx.res
-
diff --git a/src/resource.inc b/src/resource.inc
new file mode 100644
index 00000000..ca67474d
--- /dev/null
+++ b/src/resource.inc
@@ -0,0 +1,27 @@
+const
+ Resources: array[0..23, 0..1] of string = (
+ ('WINDOWICON', 'icons/ultrastardx-icon.png'),
+ ('CRDTS_BG', 'credits/credits_v5_bg.png'),
+ ('CRDTS_OVL', 'credits/credits_v5_overlay.png'),
+ ('CRDTS_blindguard', 'credits/names_blindguard.png'),
+ ('CRDTS_blindy', 'credits/names_blindy.png'),
+ ('CRDTS_canni', 'credits/names_canni.png'),
+ ('CRDTS_commandio', 'credits/names_commandio.png'),
+ ('CRDTS_lazyjoker', 'credits/names_lazyjoker.png'),
+ ('CRDTS_mog', 'credits/names_mog.png'),
+ ('CRDTS_mota', 'credits/names_mota.png'),
+ ('CRDTS_skillmaster', 'credits/names_skillmaster.png'),
+ ('CRDTS_whiteshark', 'credits/names_whiteshark.png'),
+ ('INTRO_L01', 'credits/intro-l-01.png'),
+ ('INTRO_L02', 'credits/intro-l-02.png'),
+ ('INTRO_L03', 'credits/intro-l-03.png'),
+ ('INTRO_L04', 'credits/intro-l-04.png'),
+ ('INTRO_L05', 'credits/intro-l-05.png'),
+ ('INTRO_L06', 'credits/intro-l-06.png'),
+ ('INTRO_L07', 'credits/intro-l-07.png'),
+ ('INTRO_L08', 'credits/intro-l-08.png'),
+ ('INTRO_L09', 'credits/intro-l-09.png'),
+ ('OUTRO_BG', 'credits/outro-bg.png'),
+ ('OUTRO_ESC', 'credits/outro-esc.png'),
+ ('OUTRO_EXD', 'credits/outro-exit-dark.png')
+ );
diff --git a/src/ultrastardx.dpr b/src/ultrastardx.dpr
index 6717e19c..80d92cad 100644
--- a/src/ultrastardx.dpr
+++ b/src/ultrastardx.dpr
@@ -1,7 +1,7 @@
program ultrastardx;
{$IFDEF MSWINDOWS}
- {$R 'ultrastardx.res' 'ultrastardx.rc'}
+ {$R '..\icons\ultrastardx-icon.res' '..\icons\ultrastardx-icon.rc'}
{$ENDIF}
{$IFDEF FPC}
diff --git a/src/ultrastardx.rc b/src/ultrastardx.rc
deleted file mode 100644
index a8c1aabd..00000000
--- a/src/ultrastardx.rc
+++ /dev/null
@@ -1,38 +0,0 @@
-Font TEX "../game/resources/fonts/Normal/eurostar_regular.png"
-Font FNT "../game/resources/fonts/Normal/eurostar_regular.dat"
-
-FontB TEX "../game/resources/fonts/Bold/eurostar_regular_bold.png"
-FontB FNT "../game/resources/fonts/Bold/eurostar_regular_bold.dat"
-
-FontO TEX "../game/resources/fonts/Outline 1/Outline 1.png"
-FontO FNT "../game/resources/fonts/Outline 1/Outline 1.dat"
-
-FontO2 TEX "../game/resources/fonts/Outline 2/Outline 2.png"
-FontO2 FNT "../game/resources/fonts/Outline 2/Outline 2.dat"
-
-MAINICON ICON "../icons/ultrastardx.ico"
-WINDOWICON TEX "../game/resources/icons/ultrastardx-icon.png"
-
-CRDTS_BG TEX "../game/resources/credits/credits_v5_bg.png"
-CRDTS_OVL TEX "../game/resources/credits/credits_v5_overlay.png"
-CRDTS_blindguard TEX "../game/resources/credits/names_blindguard.png"
-CRDTS_blindy TEX "../game/resources/credits/names_blindy.png"
-CRDTS_canni TEX "../game/resources/credits/names_canni.png"
-CRDTS_commandio TEX "../game/resources/credits/names_commandio.png"
-CRDTS_lazyjoker TEX "../game/resources/credits/names_lazyjoker.png"
-CRDTS_mog TEX "../game/resources/credits/names_mog.png"
-CRDTS_mota TEX "../game/resources/credits/names_mota.png"
-CRDTS_skillmaster TEX "../game/resources/credits/names_skillmaster.png"
-CRDTS_whiteshark TEX "../game/resources/credits/names_whiteshark.png"
-INTRO_L01 TEX "../game/resources/credits/intro-l-01.png"
-INTRO_L02 TEX "../game/resources/credits/intro-l-02.png"
-INTRO_L03 TEX "../game/resources/credits/intro-l-03.png"
-INTRO_L04 TEX "../game/resources/credits/intro-l-04.png"
-INTRO_L05 TEX "../game/resources/credits/intro-l-05.png"
-INTRO_L06 TEX "../game/resources/credits/intro-l-06.png"
-INTRO_L07 TEX "../game/resources/credits/intro-l-07.png"
-INTRO_L08 TEX "../game/resources/credits/intro-l-08.png"
-INTRO_L09 TEX "../game/resources/credits/intro-l-09.png"
-OUTRO_BG TEX "../game/resources/credits/outro-bg.png"
-OUTRO_ESC TEX "../game/resources/credits/outro-esc.png"
-OUTRO_EXD TEX "../game/resources/credits/outro-exit-dark.png"