119 function Str2PChar(const s: shortstring): PChar; |
119 function Str2PChar(const s: shortstring): PChar; |
120 function Surface2Tex(surf: PSDL_Surface): PTexture; |
120 function Surface2Tex(surf: PSDL_Surface): PTexture; |
121 procedure FreeTexture(tex: PTexture); |
121 procedure FreeTexture(tex: PTexture); |
122 function toPowerOf2(i: Longword): Longword; |
122 function toPowerOf2(i: Longword): Longword; |
123 function DecodeBase64(s: shortstring): shortstring; |
123 function DecodeBase64(s: shortstring): shortstring; |
|
124 procedure MakeScreenshot(s: shortstring); |
124 |
125 |
125 var CursorPoint: TPoint; |
126 var CursorPoint: TPoint; |
126 TargetPoint: TPoint = (X: NoPointX; Y: 0); |
127 TargetPoint: TPoint = (X: NoPointX; Y: 0); |
127 |
128 |
128 implementation |
129 implementation |
343 if c < 3 then t:= t - c; |
344 if c < 3 then t:= t - c; |
344 |
345 |
345 byte(DecodeBase64[0]):= t - 1 |
346 byte(DecodeBase64[0]):= t - 1 |
346 end; |
347 end; |
347 |
348 |
|
349 const GL_BGR = $80E0; // some opengl headers don't have that const (?) |
|
350 procedure MakeScreenshot(s: shortstring); |
|
351 const head: array[0..8] of Word = (0, 2, 0, 0, 0, 0, 0, 0, 24); |
|
352 var p: Pointer; |
|
353 size: Longword; |
|
354 f: file; |
|
355 begin |
|
356 head[6]:= cScreenWidth; |
|
357 head[7]:= cScreenHeight; |
|
358 |
|
359 size:= cScreenWidth * cScreenHeight * 3; |
|
360 p:= GetMem(size); |
|
361 |
|
362 glReadBuffer(GL_FRONT); |
|
363 glReadPixels(0, 0, cScreenWidth, cScreenHeight, GL_BGR, GL_UNSIGNED_BYTE, p); |
|
364 |
|
365 {$I-} |
|
366 Assign(f, s); |
|
367 Rewrite(f, 1); |
|
368 if IOResult = 0 then |
|
369 begin |
|
370 BlockWrite(f, head, sizeof(head)); |
|
371 BlockWrite(f, p^, size); |
|
372 Close(f); |
|
373 end; |
|
374 {$I+} |
|
375 |
|
376 FreeMem(p) |
|
377 end; |
|
378 |
348 {$IFDEF DEBUGFILE} |
379 {$IFDEF DEBUGFILE} |
349 procedure AddFileLog(s: shortstring); |
380 procedure AddFileLog(s: shortstring); |
350 begin |
381 begin |
351 writeln(f, GameTicks: 6, ': ', s); |
382 writeln(f, GameTicks: 6, ': ', s); |
352 flush(f) |
383 flush(f) |