hedgewars/uStore.pas
changeset 2699 249adefa9c1c
parent 2698 90585aba87ad
child 2701 3a8560c00f78
equal deleted inserted replaced
2698:90585aba87ad 2699:249adefa9c1c
    18 
    18 
    19 {$INCLUDE "options.inc"}
    19 {$INCLUDE "options.inc"}
    20 
    20 
    21 unit uStore;
    21 unit uStore;
    22 interface
    22 interface
    23 uses sysutils, uConsts, uTeams, SDLh,
    23 uses sysutils, uConsts, uTeams, SDLh, uFloat,
    24 {$IFDEF GLES11}
    24 {$IFDEF GLES11}
    25 	gles11,
    25 	gles11;
    26 {$ELSE}
    26 {$ELSE}
    27 	GL, GLext,
    27 	GL, GLext;
    28 {$ENDIF}
    28 {$ENDIF}
    29 uFloat;
    29 
    30 
    30 
       
    31 var PixelFormat: PSDL_PixelFormat;
       
    32     SDLPrimSurface: PSDL_Surface;
       
    33     PauseTexture,
       
    34     SyncTexture,
       
    35     ConfirmTexture: PTexture;
       
    36     cScaleFactor: GLfloat;
       
    37     SupportNPOTT: Boolean;
       
    38     Step: LongInt;
       
    39     squaresize : LongInt;
       
    40     numsquares : LongInt;
       
    41 {$IFDEF SDL13notworking}
       
    42     ProgrTex: TSDL_TextureID;
       
    43 {$ELSE}
       
    44     ProgrTex: PTexture;
       
    45 {$ENDIF}
       
    46 
       
    47 procedure init_uStore;
    31 procedure StoreLoad;
    48 procedure StoreLoad;
    32 procedure StoreRelease;
    49 procedure StoreRelease;
    33 procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt);
    50 procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt);
    34 procedure DrawSprite (Sprite: TSprite; X, Y, Frame: LongInt);
    51 procedure DrawSprite (Sprite: TSprite; X, Y, Frame: LongInt);
    35 procedure DrawSprite2(Sprite: TSprite; X, Y, FrameX, FrameY: LongInt);
    52 procedure DrawSprite2(Sprite: TSprite; X, Y, FrameX, FrameY: LongInt);
    58 function  LoadImage(const filename: string; imageFlags: LongInt): PSDL_Surface;
    75 function  LoadImage(const filename: string; imageFlags: LongInt): PSDL_Surface;
    59 procedure SetupOpenGL;
    76 procedure SetupOpenGL;
    60 procedure SetScale(f: GLfloat);
    77 procedure SetScale(f: GLfloat);
    61 
    78 
    62 
    79 
    63 var PixelFormat: PSDL_PixelFormat = nil;
       
    64    SDLPrimSurface: PSDL_Surface = nil;
       
    65    PauseTexture,
       
    66    SyncTexture,
       
    67    ConfirmTexture: PTexture;
       
    68    cScaleFactor: GLfloat = 2.0;
       
    69    SupportNPOTT: Boolean = false;
       
    70 
       
    71 implementation
    80 implementation
    72 uses uMisc, uConsole, uLand, uLocale, uWorld
    81 uses uMisc, uConsole, uLand, uLocale, uWorld{$IFDEF IPHONEOS}, PascalExports{$ENDIF};
    73 	{$IFDEF IPHONEOS}
       
    74 	, PascalExports
       
    75 	{$ENDIF}
       
    76 	;
       
    77 
    82 
    78 type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel);
    83 type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel);
    79 
    84 
    80 var	HHTexture: PTexture;
    85 var HHTexture: PTexture;
    81 	MaxTextureSize: Integer;
    86     MaxTextureSize: Integer;
    82 	{$IFNDEF IPHONEOS}cGPUVendor: TGPUVendor = gvUnknown;{$ENDIF}
    87     {$IFNDEF IPHONEOS}cGPUVendor: TGPUVendor;{$ENDIF}
    83 
    88 
    84 procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean);
    89 procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean);
    85 var r: TSDL_Rect;
    90 var r: TSDL_Rect;
    86 begin
    91 begin
    87 r:= rect^;
    92 r:= rect^;
  1163 
  1168 
  1164 	cScaleFactor:= f;
  1169 	cScaleFactor:= f;
  1165 end;
  1170 end;
  1166 
  1171 
  1167 ////////////////////////////////////////////////////////////////////////////////
  1172 ////////////////////////////////////////////////////////////////////////////////
  1168 var	Step: LongInt = 0;
       
  1169 	squaresize : LongInt;
       
  1170 	numsquares : LongInt;
       
  1171 {$IFDEF SDL13notworking}
       
  1172 	ProgrTex: TSDL_TextureID = 0;
       
  1173 {$ELSE}
       
  1174 	ProgrTex: PTexture = nil;
       
  1175 {$ENDIF}
       
  1176 
       
  1177 procedure AddProgress;
  1173 procedure AddProgress;
  1178 var r: TSDL_Rect;
  1174 var r: TSDL_Rect;
  1179     texsurf: PSDL_Surface;
  1175     texsurf: PSDL_Surface;
  1180 begin
  1176 begin
  1181 	if Step = 0 then
  1177 	if Step = 0 then
  1304         destPixels^[j]:= srcPixels^[i];
  1300         destPixels^[j]:= srcPixels^[i];
  1305         inc(j)
  1301         inc(j)
  1306         end;
  1302         end;
  1307 end;
  1303 end;
  1308 
  1304 
       
  1305 procedure init_uStore;
       
  1306 begin
       
  1307 	PixelFormat:= nil;
       
  1308 	SDLPrimSurface:= nil;
       
  1309 	{$IFNDEF IPHONEOS}cGPUVendor:= gvUnknown;{$ENDIF}
       
  1310 
       
  1311 	cScaleFactor:= 2.0;
       
  1312 	SupportNPOTT:= false;
       
  1313 	Step:= 0;
       
  1314 {$IFDEF SDL13notworking}
       
  1315 	ProgrTex:= 0;
       
  1316 {$ELSE}
       
  1317 	ProgrTex:= nil;
       
  1318 {$ENDIF}
       
  1319 end;
       
  1320 
  1309 end.
  1321 end.