diff -r 15487f7fed42 -r a04c30940d2d hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Thu Jul 04 11:58:40 2013 +0200 +++ b/hedgewars/uMisc.pas Sat Jul 06 19:29:18 2013 +0200 @@ -30,7 +30,7 @@ function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; function MakeScreenshot(filename: shortstring; k: LongInt): boolean; function GetTeamStatString(p: PTeam): shortstring; -{$IFDEF SDL13} +{$IFDEF SDL2} function SDL_RectMake(x, y, width, height: LongInt): TSDL_Rect; inline; {$ELSE} function SDL_RectMake(x, y: SmallInt; width, height: Word): TSDL_Rect; inline; @@ -261,7 +261,7 @@ image^.size:= size; image^.buffer:= p; -SDL_CreateThread(@SaveScreenshot{$IFDEF SDL13}, 'snapshot'{$ENDIF}, image); +SDL_CreateThread(@SaveScreenshot{$IFDEF SDL2}, 'snapshot'{$ENDIF}, image); MakeScreenshot:= true; // possibly it is not true but we will not wait for thread to terminate end; @@ -279,7 +279,7 @@ end; end; -{$IFDEF SDL13} +{$IFDEF SDL2} function SDL_RectMake(x, y, width, height: LongInt): TSDL_Rect; inline; {$ELSE} function SDL_RectMake(x, y: SmallInt; width, height: Word): TSDL_Rect; inline; @@ -299,14 +299,29 @@ end; procedure initModule; +{$IFDEF SDL2} const SDL_PIXELFORMAT_ABGR8888 = (1 shl 28) or (6 shl 24) or (7 shl 20) or (6 shl 16) or (32 shl 8) or 4; +{$ELSE} +const format: TSDL_PixelFormat = ( + palette: nil; BitsPerPixel: 32; BytesPerPixel: 4; + Rloss: 0; Gloss: 0; Bloss: 0; Aloss: 0; + Rshift: RShift; Gshift: GShift; Bshift: BShift; Ashift: AShift; + RMask: RMask; GMask: GMask; BMask: BMask; AMask: AMask; + colorkey: 0; alpha: 255); +{$ENDIF} begin +{$IFDEF SDL2} conversionFormat:= SDL_AllocFormat(SDL_PIXELFORMAT_ABGR8888); +{$ELSE} + conversionFormat:= @format; +{$ENDIF} end; procedure freeModule; begin +{$IFDEF SDL2} SDL_FreeFormat(conversionFormat); +{$ENDIF} end; end.