hedgewars/uMisc.pas
changeset 7110 c91d33837b0d
parent 7049 35d762458d66
child 7306 3cff5c769509
equal deleted inserted replaced
7020:846cea23aea2 7110:c91d33837b0d
    35 {$ELSE}
    35 {$ELSE}
    36 function  SDL_RectMake(x, y: SmallInt; width, height: Word): TSDL_Rect; inline;
    36 function  SDL_RectMake(x, y: SmallInt; width, height: Word): TSDL_Rect; inline;
    37 {$ENDIF}
    37 {$ENDIF}
    38 
    38 
    39 implementation
    39 implementation
    40 uses typinfo, sysutils, uVariables, uUtils
    40 uses SysUtils, uVariables, uUtils
    41      {$IFDEF PNG_SCREENSHOTS}, PNGh, png {$ENDIF}
    41      {$IFDEF PNG_SCREENSHOTS}, PNGh, png {$ENDIF}
    42      {$IFNDEF USE_SDLTHREADS} {$IFDEF UNIX}, cthreads{$ENDIF} {$ENDIF};
    42      {$IFNDEF USE_SDLTHREADS} {$IFDEF UNIX}, cthreads{$ENDIF} {$ENDIF};
    43 
    43 
    44 type PScreenshot = ^TScreenshot;
    44 type PScreenshot = ^TScreenshot;
    45      TScreenshot = record
    45      TScreenshot = record
    46          buffer: PByte;
    46          buffer: PByte;
    47          filename: shortstring;
    47          filename: shortstring;
    48          width, height: LongInt;
    48          width, height: LongInt;
    49          size: QWord;
    49          size: QWord;
    50          end;
    50          end;
       
    51 
       
    52 var conversionFormat: PSDL_PixelFormat;
    51 
    53 
    52 procedure movecursor(dx, dy: LongInt);
    54 procedure movecursor(dx, dy: LongInt);
    53 var x, y: LongInt;
    55 var x, y: LongInt;
    54 begin
    56 begin
    55 if (dx = 0) and (dy = 0) then exit;
    57 if (dx = 0) and (dy = 0) then exit;
   240 var convertedSurf: PSDL_Surface;
   242 var convertedSurf: PSDL_Surface;
   241 begin
   243 begin
   242     doSurfaceConversion:= tmpsurf;
   244     doSurfaceConversion:= tmpsurf;
   243     if ((tmpsurf^.format^.bitsperpixel = 32) and (tmpsurf^.format^.rshift > tmpsurf^.format^.bshift)) or
   245     if ((tmpsurf^.format^.bitsperpixel = 32) and (tmpsurf^.format^.rshift > tmpsurf^.format^.bshift)) or
   244        (tmpsurf^.format^.bitsperpixel = 24) then
   246        (tmpsurf^.format^.bitsperpixel = 24) then
   245         begin
   247     begin
   246         convertedSurf:= SDL_ConvertSurface(tmpsurf, conversionFormat, SDL_SWSURFACE);
   248         convertedSurf:= SDL_ConvertSurface(tmpsurf, conversionFormat, SDL_SWSURFACE);
   247         SDL_FreeSurface(tmpsurf);
   249         SDL_FreeSurface(tmpsurf);
   248         doSurfaceConversion:= convertedSurf;
   250         doSurfaceConversion:= convertedSurf;
   249         end;
   251     end;
   250 end;
   252 end;
   251 
   253 
   252 {$IFDEF SDL13}
   254 {$IFDEF SDL13}
   253 function SDL_RectMake(x, y, width, height: LongInt): TSDL_Rect; inline;
   255 function SDL_RectMake(x, y, width, height: LongInt): TSDL_Rect; inline;
   254 {$ELSE}
   256 {$ELSE}