491 |
491 |
492 byte(DecodeBase64[0]):= t - 1 |
492 byte(DecodeBase64[0]):= t - 1 |
493 end; |
493 end; |
494 |
494 |
495 {$IFNDEF IPHONEOS} |
495 {$IFNDEF IPHONEOS} |
496 procedure MakeScreenshot(s: shortstring); |
496 procedure MakeScreenshot(filename: shortstring); |
497 const head: array[0..8] of Word = (0, 2, 0, 0, 0, 0, 0, 0, 24); |
|
498 var p: Pointer; |
497 var p: Pointer; |
499 size: Longword; |
498 size: Longword; |
500 f: file; |
499 f: file; |
|
500 {$IFNDEF WIN32} |
|
501 // TGA Header |
|
502 head: array[0..8] of Word = (0, 2, 0, 0, 0, 0, 0, 0, 24); |
|
503 {$ELSE} |
|
504 // Windows Bitmap Header |
|
505 head: array[0..53] of Byte = ( |
|
506 $42, $4D, // identifier ("BM") |
|
507 0, 0, 0, 0, // file size |
|
508 0, 0, 0, 0, // reserved |
|
509 54, 0, 0, 0, // starting offset |
|
510 40, 0, 0, 0, // header size |
|
511 0, 0, 0, 0, // width |
|
512 0, 0, 0, 0, // height |
|
513 1, 0, // color planes |
|
514 24, 0, // bit depth |
|
515 0, 0, 0, 0, // compression method (uncompressed) |
|
516 0, 0, 0, 0, // image size |
|
517 96, 0, 0, 0, // horizontal resolution |
|
518 96, 0, 0, 0, // vertical resolution |
|
519 0, 0, 0, 0, // number of colors (all) |
|
520 0, 0, 0, 0 // number of important colors |
|
521 ); |
|
522 {$ENDIF} |
501 begin |
523 begin |
502 playSound(sndShutter, false, nil); |
524 playSound(sndShutter, false, nil); |
|
525 |
|
526 size:= cScreenWidth * cScreenHeight * 3; |
|
527 p:= GetMem(size); |
|
528 |
|
529 // update header information and file name |
|
530 {$IFNDEF WIN32} |
|
531 filename:= ParamStr(1) + '/' + filename + '.tga'; |
|
532 |
503 head[6]:= cScreenWidth; |
533 head[6]:= cScreenWidth; |
504 head[7]:= cScreenHeight; |
534 head[7]:= cScreenHeight; |
505 |
535 {$ELSE} |
506 size:= cScreenWidth * cScreenHeight * 3; |
536 filename:= ParamStr(1) + '/' + filename + '.bmp'; |
507 p:= GetMem(size); |
537 |
508 |
538 head[$02]:= (size + 54) and $ff; |
|
539 head[$03]:= ((size + 54) shr 8) and $ff; |
|
540 head[$04]:= ((size + 54) shr 16) and $ff; |
|
541 head[$05]:= ((size + 54) shr 24) and $ff; |
|
542 head[$12]:= cScreenWidth and $ff; |
|
543 head[$13]:= (cScreenWidth shr 8) and $ff; |
|
544 head[$14]:= (cScreenWidth shr 16) and $ff; |
|
545 head[$15]:= (cScreenWidth shr 24) and $ff; |
|
546 head[$16]:= cScreenHeight and $ff; |
|
547 head[$17]:= (cScreenHeight shr 8) and $ff; |
|
548 head[$18]:= (cScreenHeight shr 16) and $ff; |
|
549 head[$19]:= (cScreenHeight shr 24) and $ff; |
|
550 head[$22]:= size and $ff; |
|
551 head[$23]:= (size shr 8) and $ff; |
|
552 head[$24]:= (size shr 16) and $ff; |
|
553 head[$25]:= (size shr 24) and $ff; |
|
554 {$ENDIF} |
509 |
555 |
510 //remember that opengles operates on a single surface, so GL_FRONT *should* be implied |
556 //remember that opengles operates on a single surface, so GL_FRONT *should* be implied |
511 glReadBuffer(GL_FRONT); |
557 glReadBuffer(GL_FRONT); |
512 glReadPixels(0, 0, cScreenWidth, cScreenHeight, GL_BGR, GL_UNSIGNED_BYTE, p); |
558 glReadPixels(0, 0, cScreenWidth, cScreenHeight, GL_BGR, GL_UNSIGNED_BYTE, p); |
513 |
559 |
514 {$I-} |
560 {$I-} |
515 Assign(f, s); |
561 Assign(f, filename); |
516 Rewrite(f, 1); |
562 Rewrite(f, 1); |
517 if IOResult = 0 then |
563 if IOResult = 0 then |
518 begin |
564 begin |
519 BlockWrite(f, head, sizeof(head)); |
565 BlockWrite(f, head, sizeof(head)); |
520 BlockWrite(f, p^, size); |
566 BlockWrite(f, p^, size); |