Making a screenshot is very easy:
Deprecated: Function create_function() is deprecated in /var/www/cge-www-preview/geshi/geshi.php on line 4751
procedure TakeScreenshot; var Image: TRGBImage; begin Image := Control.SaveScreen; try SaveImage(Image, 'screenshot_name.png'); finally FreeAndNil(Image) end; end; // Call TakeScreenshot // from wherever you want in your game. // For example, from the OnPress event.
TRGBImage, and it's ancestor TCastleImage and many other similar classes, are defined in the unit CastleImages. This unit provides various image loading, saving and processing utilities to our engine.
Note: we have our own image handling unit, to store images in the format best suitable for 3D graphics libraries, like OpenGL. This gives us some capabilities not found in common image libraries, for example we seamlessly handle S3TC compressed images (class TS3TCImage), 3D textures and float textures. Still, we use the excellent FPC FpImage library to load/save some image formats underneath.
Copyright Michalis Kamburelis and others. Particular thanks go to Paweł Wojciechowicz from Cat-astrophe Games for various graphics. Even this documentation is open-source and you can redistribute it on open-source terms, in particular CC BY-SA.