aboutsummaryrefslogtreecommitdiffstats
path: root/src/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'src/macosx')
-rw-r--r--src/macosx/MacResources.pas176
-rw-r--r--src/macosx/PseudoThread.pas3
-rw-r--r--src/macosx/Windows.pas168
3 files changed, 176 insertions, 171 deletions
diff --git a/src/macosx/MacResources.pas b/src/macosx/MacResources.pas
index a97fb565..fa67ad23 100644
--- a/src/macosx/MacResources.pas
+++ b/src/macosx/MacResources.pas
@@ -5,120 +5,122 @@ unit MacResources;
interface
uses
- Classes, Windows, SysUtils;
+ Classes, Windows, SysUtils;
type
TResourceStream = class(TFileStream)
private
public
- constructor Create(Instance: THandle; const ResName: string; ResType: PChar);
+ constructor Create(Instance: THandle; const ResName: String; ResType: PChar);
end;
- Function FindResource( hInstance : THandle; pcIdentifier : PChar; pcResType : PChar) : THandle;
+function FindResource(hInstance: THandle; pcIdentifier: PChar; pcResType: PChar): THandle;
implementation
-Function FindResource( hInstance : THandle; pcIdentifier : PChar; pcResType : PChar) : THandle;
+function FindResource(hInstance : THandle; pcIdentifier: PChar; pcResType: PChar): THandle;
begin
- Result := 1;
+ Result := 1;
end;
-Function GetResourcesPath : String;
+function GetResourcesPath : String;
var
- x,
- i : integer;
+ i, j: 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] = '/');
+ 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);
+constructor TResourceStream.Create(Instance: THandle; const ResName: String; ResType: PChar);
var
- sResNameLower : string;
- sFileName : String;
+ 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;
+ 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)
+ inherited Create(sFileName, fmOpenReadWrite)
else
- raise Exception.Create('MacResources.TResourceStream.Create: File "' + sFileName + '" not found.');
+ raise Exception.Create('MacResources.TResourceStream.Create: File "' + sFileName + '" not found.');
end;
end.
diff --git a/src/macosx/PseudoThread.pas b/src/macosx/PseudoThread.pas
index 16157646..21e93341 100644
--- a/src/macosx/PseudoThread.pas
+++ b/src/macosx/PseudoThread.pas
@@ -30,7 +30,8 @@ implementation
constructor TPseudoThread.Create(const suspended : Boolean);
begin
- if not suspended then begin
+ if not suspended then
+ begin
Execute;
end;
end;
diff --git a/src/macosx/Windows.pas b/src/macosx/Windows.pas
index cee75591..26761af5 100644
--- a/src/macosx/Windows.pas
+++ b/src/macosx/Windows.pas
@@ -4,7 +4,8 @@ unit Windows;
interface
-uses Types;
+uses
+ Types;
const
opengl32 = 'OpenGL';
@@ -12,31 +13,31 @@ const
type
- DWORD = Types.DWORD;
- {$EXTERNALSYM DWORD}
- BOOL = LongBool;
- {$EXTERNALSYM BOOL}
- PBOOL = ^BOOL;
- {$EXTERNALSYM PBOOL}
- PByte = Types.PByte;
- PINT = ^Integer;
- {$EXTERNALSYM PINT}
- PSingle = ^Single;
- PWORD = ^Word;
- {$EXTERNALSYM PWORD}
- PDWORD = ^DWORD;
- {$EXTERNALSYM PDWORD}
- LPDWORD = PDWORD;
- {$EXTERNALSYM LPDWORD}
- HDC = type LongWord;
- {$EXTERNALSYM HDC}
- HGLRC = type LongWord;
- {$EXTERNALSYM HGLRC}
- TLargeInteger = Int64;
- HFONT = type LongWord;
- {$EXTERNALSYM HFONT}
- HWND = type LongWord;
- {$EXTERNALSYM HWND}
+ DWORD = Types.DWORD;
+ {$EXTERNALSYM DWORD}
+ BOOL = LongBool;
+ {$EXTERNALSYM BOOL}
+ PBOOL = ^BOOL;
+ {$EXTERNALSYM PBOOL}
+ PByte = Types.PByte;
+ PINT = ^Integer;
+ {$EXTERNALSYM PINT}
+ PSingle = ^Single;
+ PWORD = ^Word;
+ {$EXTERNALSYM PWORD}
+ PDWORD = ^DWORD;
+ {$EXTERNALSYM PDWORD}
+ LPDWORD = PDWORD;
+ {$EXTERNALSYM LPDWORD}
+ HDC = type LongWord;
+ {$EXTERNALSYM HDC}
+ HGLRC = type LongWord;
+ {$EXTERNALSYM HGLRC}
+ TLargeInteger = Int64;
+ HFONT = type LongWord;
+ {$EXTERNALSYM HFONT}
+ HWND = type LongWord;
+ {$EXTERNALSYM HWND}
PPaletteEntry = ^TPaletteEntry;
{$EXTERNALSYM tagPALETTEENTRY}
@@ -50,46 +51,46 @@ type
{$EXTERNALSYM PALETTEENTRY}
PALETTEENTRY = tagPALETTEENTRY;
- PRGBQuad = ^TRGBQuad;
- {$EXTERNALSYM tagRGBQUAD}
- tagRGBQUAD = packed record
- rgbBlue: Byte;
- rgbGreen: Byte;
- rgbRed: Byte;
- rgbReserved: Byte;
- end;
- TRGBQuad = tagRGBQUAD;
- {$EXTERNALSYM RGBQUAD}
- RGBQUAD = tagRGBQUAD;
-
- PBitmapInfoHeader = ^TBitmapInfoHeader;
- {$EXTERNALSYM tagBITMAPINFOHEADER}
- tagBITMAPINFOHEADER = packed record
- biSize: DWORD;
- biWidth: Longint;
- biHeight: Longint;
- biPlanes: Word;
- biBitCount: Word;
- biCompression: DWORD;
- biSizeImage: DWORD;
- biXPelsPerMeter: Longint;
- biYPelsPerMeter: Longint;
- biClrUsed: DWORD;
- biClrImportant: DWORD;
- end;
- TBitmapInfoHeader = tagBITMAPINFOHEADER;
- {$EXTERNALSYM BITMAPINFOHEADER}
- BITMAPINFOHEADER = tagBITMAPINFOHEADER;
-
- PBitmapInfo = ^TBitmapInfo;
- {$EXTERNALSYM tagBITMAPINFO}
- tagBITMAPINFO = packed record
- bmiHeader: TBitmapInfoHeader;
- bmiColors: array[0..0] of TRGBQuad;
- end;
- TBitmapInfo = tagBITMAPINFO;
- {$EXTERNALSYM BITMAPINFO}
- BITMAPINFO = tagBITMAPINFO;
+ PRGBQuad = ^TRGBQuad;
+ {$EXTERNALSYM tagRGBQUAD}
+ tagRGBQUAD = packed record
+ rgbBlue: Byte;
+ rgbGreen: Byte;
+ rgbRed: Byte;
+ rgbReserved: Byte;
+ end;
+ TRGBQuad = tagRGBQUAD;
+ {$EXTERNALSYM RGBQUAD}
+ RGBQUAD = tagRGBQUAD;
+
+ PBitmapInfoHeader = ^TBitmapInfoHeader;
+ {$EXTERNALSYM tagBITMAPINFOHEADER}
+ tagBITMAPINFOHEADER = packed record
+ biSize: DWORD;
+ biWidth: Longint;
+ biHeight: Longint;
+ biPlanes: Word;
+ biBitCount: Word;
+ biCompression: DWORD;
+ biSizeImage: DWORD;
+ biXPelsPerMeter: Longint;
+ biYPelsPerMeter: Longint;
+ biClrUsed: DWORD;
+ biClrImportant: DWORD;
+ end;
+ TBitmapInfoHeader = tagBITMAPINFOHEADER;
+ {$EXTERNALSYM BITMAPINFOHEADER}
+ BITMAPINFOHEADER = tagBITMAPINFOHEADER;
+
+ PBitmapInfo = ^TBitmapInfo;
+ {$EXTERNALSYM tagBITMAPINFO}
+ tagBITMAPINFO = packed record
+ bmiHeader: TBitmapInfoHeader;
+ bmiColors: array[0..0] of TRGBQuad;
+ end;
+ TBitmapInfo = tagBITMAPINFO;
+ {$EXTERNALSYM BITMAPINFO}
+ BITMAPINFO = tagBITMAPINFO;
PBitmapFileHeader = ^TBitmapFileHeader;
{$EXTERNALSYM tagBITMAPFILEHEADER}
@@ -105,24 +106,25 @@ type
BITMAPFILEHEADER = tagBITMAPFILEHEADER;
- function MakeLong(a, b: Word): Longint;
- procedure ZeroMemory(Destination: Pointer; Length: DWORD);
- function QueryPerformanceFrequency(var lpFrequency: TLargeInteger): BOOL;
- function QueryPerformanceCounter(var lpPerformanceCount: TLargeInteger): BOOL;
- function GetTickCount : Cardinal;
- Procedure ShowMessage(msg : string);
- procedure CopyMemory(Destination: Pointer; Source: Pointer; Length: DWORD);
+function MakeLong(a, b: Word): Longint;
+procedure ZeroMemory(Destination: Pointer; Length: DWORD);
+function QueryPerformanceFrequency(var lpFrequency: TLargeInteger): BOOL;
+function QueryPerformanceCounter(var lpPerformanceCount: TLargeInteger): BOOL;
+function GetTickCount : Cardinal;
+Procedure ShowMessage(msg : String);
+procedure CopyMemory(Destination: Pointer; Source: Pointer; Length: DWORD);
implementation
-uses SDL;
+uses
+ SDL;
procedure CopyMemory(Destination: Pointer; Source: Pointer; Length: DWORD);
begin
Move(Source^, Destination^, Length);
end;
-Procedure ShowMessage(msg : string);
+procedure ShowMessage(msg : String);
begin
// to be implemented
end;
@@ -134,34 +136,34 @@ end;
procedure ZeroMemory(Destination: Pointer; Length: DWORD);
begin
- FillChar( Destination^, Length, 0);
+ FillChar( Destination^, Length, 0);
end;
function QueryPerformanceFrequency(var lpFrequency: TLargeInteger): BOOL;
begin
{$IFDEF MSWINDOWS}
- Result := Windows.QueryPerformanceFrequency(lpFrequency);
+ Result := Windows.QueryPerformanceFrequency(lpFrequency);
{$ENDIF}
{$IFDEF MACOS}
- Result := true;
- lpFrequency := 1000;
+ Result := true;
+ lpFrequency := 1000;
{$ENDIF}
end;
function QueryPerformanceCounter(var lpPerformanceCount: TLargeInteger): BOOL;
begin
{$IFDEF MSWINDOWS}
- Result := Windows.QueryPerformanceCounter(lpPerformanceCount);
+ Result := Windows.QueryPerformanceCounter(lpPerformanceCount);
{$ENDIF}
{$IFDEF MACOS}
- Result := true;
- lpPerformanceCount := SDL_GetTicks;
+ Result := true;
+ lpPerformanceCount := SDL_GetTicks;
{$ENDIF}
end;
function GetTickCount : Cardinal;
begin
- Result := SDL_GetTicks;
+ Result := SDL_GetTicks;
end;
end.