175 function endian(independent: LongWord): LongWord; |
175 function endian(independent: LongWord): LongWord; |
176 {$IFDEF DEBUGFILE} |
176 {$IFDEF DEBUGFILE} |
177 procedure AddFileLog(s: shortstring); |
177 procedure AddFileLog(s: shortstring); |
178 function RectToStr(Rect: TSDL_Rect): shortstring; |
178 function RectToStr(Rect: TSDL_Rect): shortstring; |
179 {$ENDIF} |
179 {$ENDIF} |
180 {$IFNDEF IPHONEOS} |
|
181 procedure MakeScreenshot(filename: shortstring); |
180 procedure MakeScreenshot(filename: shortstring); |
182 {$ENDIF} |
|
183 |
181 |
184 implementation |
182 implementation |
185 uses uConsole, uStore, uIO, uSound, typinfo, sysutils; |
183 uses uConsole, uStore, uIO, uSound, typinfo, sysutils; |
186 |
184 |
187 var KBnum: Longword; |
185 var KBnum: Longword; |
558 if c < 3 then t:= t - c; |
556 if c < 3 then t:= t - c; |
559 |
557 |
560 byte(DecodeBase64[0]):= t - 1 |
558 byte(DecodeBase64[0]):= t - 1 |
561 end; |
559 end; |
562 |
560 |
563 {$IFNDEF IPHONEOS} |
|
564 procedure MakeScreenshot(filename: shortstring); |
561 procedure MakeScreenshot(filename: shortstring); |
565 var p: Pointer; |
562 var p: Pointer; |
566 size: Longword; |
563 size: Longword; |
567 f: file; |
564 f: file; |
568 {$IFNDEF WIN32} |
|
569 // TGA Header |
|
570 head: array[0..8] of Word = (0, 2, 0, 0, 0, 0, 0, 0, 24); |
|
571 {$ELSE} |
|
572 // Windows Bitmap Header |
565 // Windows Bitmap Header |
573 head: array[0..53] of Byte = ( |
566 head: array[0..53] of Byte = ( |
574 $42, $4D, // identifier ("BM") |
567 $42, $4D, // identifier ("BM") |
575 0, 0, 0, 0, // file size |
568 0, 0, 0, 0, // file size |
576 0, 0, 0, 0, // reserved |
569 0, 0, 0, 0, // reserved |
585 96, 0, 0, 0, // horizontal resolution |
578 96, 0, 0, 0, // horizontal resolution |
586 96, 0, 0, 0, // vertical resolution |
579 96, 0, 0, 0, // vertical resolution |
587 0, 0, 0, 0, // number of colors (all) |
580 0, 0, 0, 0, // number of colors (all) |
588 0, 0, 0, 0 // number of important colors |
581 0, 0, 0, 0 // number of important colors |
589 ); |
582 ); |
590 {$ENDIF} |
|
591 begin |
583 begin |
592 playSound(sndShutter); |
584 playSound(sndShutter); |
593 |
585 |
594 // flash |
586 // flash |
595 ScreenFade:= sfFromWhite; |
587 ScreenFade:= sfFromWhite; |
598 |
590 |
599 size:= cScreenWidth * cScreenHeight * 3; |
591 size:= cScreenWidth * cScreenHeight * 3; |
600 p:= GetMem(size); |
592 p:= GetMem(size); |
601 |
593 |
602 // update header information and file name |
594 // update header information and file name |
603 {$IFNDEF WIN32} |
595 |
604 filename:= ParamStr(1) + '/Screenshots/' + filename + '.tga'; |
|
605 |
|
606 head[6]:= cScreenWidth; |
|
607 head[7]:= cScreenHeight; |
|
608 {$ELSE} |
|
609 filename:= ParamStr(1) + '/Screenshots/' + filename + '.bmp'; |
596 filename:= ParamStr(1) + '/Screenshots/' + filename + '.bmp'; |
610 |
597 |
611 head[$02]:= (size + 54) and $ff; |
598 head[$02]:= (size + 54) and $ff; |
612 head[$03]:= ((size + 54) shr 8) and $ff; |
599 head[$03]:= ((size + 54) shr 8) and $ff; |
613 head[$04]:= ((size + 54) shr 16) and $ff; |
600 head[$04]:= ((size + 54) shr 16) and $ff; |
622 head[$19]:= (cScreenHeight shr 24) and $ff; |
609 head[$19]:= (cScreenHeight shr 24) and $ff; |
623 head[$22]:= size and $ff; |
610 head[$22]:= size and $ff; |
624 head[$23]:= (size shr 8) and $ff; |
611 head[$23]:= (size shr 8) and $ff; |
625 head[$24]:= (size shr 16) and $ff; |
612 head[$24]:= (size shr 16) and $ff; |
626 head[$25]:= (size shr 24) and $ff; |
613 head[$25]:= (size shr 24) and $ff; |
627 {$ENDIF} |
|
628 |
614 |
629 //remember that opengles operates on a single surface, so GL_FRONT *should* be implied |
615 //remember that opengles operates on a single surface, so GL_FRONT *should* be implied |
630 glReadBuffer(GL_FRONT); |
616 //glReadBuffer(GL_FRONT); |
631 glReadPixels(0, 0, cScreenWidth, cScreenHeight, GL_BGR, GL_UNSIGNED_BYTE, p); |
617 glReadPixels(0, 0, cScreenWidth, cScreenHeight, GL_BGR, GL_UNSIGNED_BYTE, p); |
632 |
618 |
633 {$I-} |
619 {$I-} |
634 Assign(f, filename); |
620 Assign(f, filename); |
635 Rewrite(f, 1); |
621 Rewrite(f, 1); |