aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/MacOSX/Wrapper/MacClasses.pas
blob: be41ac55b124ecf22376e91bfcc5ac878b69b6c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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.