aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/MacOSX/Wrapper
diff options
context:
space:
mode:
authoreddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-11-04 15:23:42 +0000
committereddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-11-04 15:23:42 +0000
commit9edc9535e5570807990e39703dca7c05e6758256 (patch)
tree2d330b6ebb37cc7faf9a5861a81f787a4c05fd98 /Game/Code/MacOSX/Wrapper
parent19149849a2de8bf79d9f9095e290fd662efa7238 (diff)
downloadusdx-9edc9535e5570807990e39703dca7c05e6758256.tar.gz
usdx-9edc9535e5570807990e39703dca7c05e6758256.tar.xz
usdx-9edc9535e5570807990e39703dca7c05e6758256.zip
Added MacResources.pas. Fixed some resource loading issues on OS X. The main screen is still not loading.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@581 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/MacOSX/Wrapper')
-rwxr-xr-xGame/Code/MacOSX/Wrapper/MacClasses.pas57
-rwxr-xr-xGame/Code/MacOSX/Wrapper/MacResources.pas72
2 files changed, 72 insertions, 57 deletions
diff --git a/Game/Code/MacOSX/Wrapper/MacClasses.pas b/Game/Code/MacOSX/Wrapper/MacClasses.pas
deleted file mode 100755
index be41ac55..00000000
--- a/Game/Code/MacOSX/Wrapper/MacClasses.pas
+++ /dev/null
@@ -1,57 +0,0 @@
-unit MacClasses;
-
-{$I switches.inc}
-
-interface
-
-uses
- Classes, GlueWindows, SysUtils;
-
-type
-
- TMemoryStream = Classes.TMemoryStream;
-
- TResourceStream = class(TFileStream)
- private
- public
- constructor Create(Instance: THandle; const ResName: string; ResType: PChar);
- end;
-
-{$IFDEF MACOS}
- TWndMethod = procedure of object;
-{$ENDIF}
-
- function AllocateHWnd(Method: TWndMethod): HWND;
-
-implementation
-
-uses UPliki;
-
-{ TResourceStream }
-
-constructor TResourceStream.Create(Instance: THandle; const ResName: string; ResType: PChar);
-var
- sFileName : String;
-begin
- if ResType = 'FNT' then
- sFileName := GetResourcesPath + 'Fonts/' + ResName + '.dat'
- else
- sFileName := GetResourcesPath + 'Fonts/' + ResName + '.' + ResType;
-
- if FileExists(sFileName) then
- inherited Create( sFileName, fmOpenReadWrite)
- else
- inherited Create( sFileName, fmCreate);
-end;
-
-function AllocateHWnd(Method: TWndMethod): HWND;
-begin
-{$IFDEF MSWINDOWS}
- Result := Classes.AllocateHWnd(Method);
-{$ENDIF}
-{$IFDEF MACOS}
- Result := 0;
-{$ENDIF}
-end;
-
-end.
diff --git a/Game/Code/MacOSX/Wrapper/MacResources.pas b/Game/Code/MacOSX/Wrapper/MacResources.pas
new file mode 100755
index 00000000..d408a432
--- /dev/null
+++ b/Game/Code/MacOSX/Wrapper/MacResources.pas
@@ -0,0 +1,72 @@
+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
+ x,
+ i : integer;
+begin
+ Result := ExtractFilePath(ParamStr(0));
+ for x := 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 sResNameLower = 'font' then
+ sFileName := GetResourcesPath + 'Fonts/Normal/Font Normal 16.png'
+ else if sResNameLower = 'fontb' then
+ sFileName := GetResourcesPath + 'Fonts/Bold/Font 1024 Bold 16.png'
+ else if sResNameLower = 'fonto' then
+ sFileName := GetResourcesPath + 'Fonts/Outline 1/Outline 1.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'
+ else if sResNameLower = 'fonto2' then
+ sFileName := GetResourcesPath + 'Fonts/Outline 2/Outline 2.png';
+
+ if FileExists(sFileName) then
+ inherited Create( sFileName, fmOpenReadWrite)
+ else
+ raise Exception.Create('MacResources.TResourceStream.Create: File "' + sFileName + '" not found.');
+end;
+
+end.