equal
deleted
inserted
replaced
28 |
28 |
29 procedure movecursor(dx, dy: LongInt); |
29 procedure movecursor(dx, dy: LongInt); |
30 function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; |
30 function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; |
31 function MakeScreenshot(filename: shortstring; k: LongInt): boolean; |
31 function MakeScreenshot(filename: shortstring; k: LongInt): boolean; |
32 function GetTeamStatString(p: PTeam): shortstring; |
32 function GetTeamStatString(p: PTeam): shortstring; |
33 {$IFDEF SDL13} |
33 {$IFDEF SDL2} |
34 function SDL_RectMake(x, y, width, height: LongInt): TSDL_Rect; inline; |
34 function SDL_RectMake(x, y, width, height: LongInt): TSDL_Rect; inline; |
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 |
260 image^.width:= cScreenWidth div k; |
260 image^.width:= cScreenWidth div k; |
261 image^.height:= cScreenHeight div k; |
261 image^.height:= cScreenHeight div k; |
262 image^.size:= size; |
262 image^.size:= size; |
263 image^.buffer:= p; |
263 image^.buffer:= p; |
264 |
264 |
265 SDL_CreateThread(@SaveScreenshot{$IFDEF SDL13}, 'snapshot'{$ENDIF}, image); |
265 SDL_CreateThread(@SaveScreenshot{$IFDEF SDL2}, 'snapshot'{$ENDIF}, image); |
266 MakeScreenshot:= true; // possibly it is not true but we will not wait for thread to terminate |
266 MakeScreenshot:= true; // possibly it is not true but we will not wait for thread to terminate |
267 end; |
267 end; |
268 |
268 |
269 // http://www.idevgames.com/forums/thread-5602-post-21860.html#pid21860 |
269 // http://www.idevgames.com/forums/thread-5602-post-21860.html#pid21860 |
270 function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; |
270 function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; |
280 doSurfaceConversion:= convertedSurf; |
280 doSurfaceConversion:= convertedSurf; |
281 end; |
281 end; |
282 {$ENDIF} |
282 {$ENDIF} |
283 end; |
283 end; |
284 |
284 |
285 {$IFDEF SDL13} |
285 {$IFDEF SDL2} |
286 function SDL_RectMake(x, y, width, height: LongInt): TSDL_Rect; inline; |
286 function SDL_RectMake(x, y, width, height: LongInt): TSDL_Rect; inline; |
287 {$ELSE} |
287 {$ELSE} |
288 function SDL_RectMake(x, y: SmallInt; width, height: Word): TSDL_Rect; inline; |
288 function SDL_RectMake(x, y: SmallInt; width, height: Word): TSDL_Rect; inline; |
289 {$ENDIF} |
289 {$ENDIF} |
290 begin |
290 begin |
300 s:= p^.TeamName + ':' + IntToStr(p^.TeamHealth) + ':'; |
300 s:= p^.TeamName + ':' + IntToStr(p^.TeamHealth) + ':'; |
301 GetTeamStatString:= s; |
301 GetTeamStatString:= s; |
302 end; |
302 end; |
303 |
303 |
304 procedure initModule; |
304 procedure initModule; |
305 const SDL_PIXELFORMAT_ABGR8888 = (1 shl 31) or (6 shl 24) or (7 shl 20) or (6 shl 16) or (32 shl 8) or 4; |
305 {$IFDEF SDL2} |
306 begin |
306 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; |
|
307 {$ELSE} |
|
308 const format: TSDL_PixelFormat = ( |
|
309 palette: nil; BitsPerPixel: 32; BytesPerPixel: 4; |
|
310 Rloss: 0; Gloss: 0; Bloss: 0; Aloss: 0; |
|
311 Rshift: RShift; Gshift: GShift; Bshift: BShift; Ashift: AShift; |
|
312 RMask: RMask; GMask: GMask; BMask: BMask; AMask: AMask; |
|
313 colorkey: 0; alpha: 255); |
|
314 {$ENDIF} |
|
315 begin |
|
316 {$IFDEF SDL2} |
307 conversionFormat:= SDL_AllocFormat(SDL_PIXELFORMAT_ABGR8888); |
317 conversionFormat:= SDL_AllocFormat(SDL_PIXELFORMAT_ABGR8888); |
|
318 {$ELSE} |
|
319 conversionFormat:= @format; |
|
320 {$ENDIF} |
308 end; |
321 end; |
309 |
322 |
310 procedure freeModule; |
323 procedure freeModule; |
311 begin |
324 begin |
|
325 {$IFDEF SDL2} |
312 SDL_FreeFormat(conversionFormat); |
326 SDL_FreeFormat(conversionFormat); |
|
327 {$ENDIF} |
313 end; |
328 end; |
314 |
329 |
315 end. |
330 end. |