spacer graphic
spacer graphic
Montage of games AGS Logo
spacer graphic

 

spacer graphic
Menu
spacer graphic Home
About
News
Features
Download AGS
spacer graphic Games 
Games main page
Award Winners
Picks of the month
Short games
Medium length games
Full length games
In Production
Hints & Tips
Community
Forums
AGSers World Map
Member websites
Chat
Resources
Tutorials
FAQ
Knowledge Base
Downloads
Links
AGS-related links
* AGS Manual
  * Scripting
    * DynamicSprite functions and properties

CreateFromScreenShot

static DynamicSprite* DynamicSprite.CreateFromScreenShot
                        (optional int width, optional int height)
Creates a new DynamicSprite instance with a copy of the current screen in it, resized to WIDTH x HEIGHT. If you do not supply the width or height, then a full screen sized sprite will be created.

This command can be useful if you're creating a save game screenshots GUI, in order to display the current game position as well as the saved slot positions.

NOTE: This command can be slow when using the Direct3D graphics driver.

IMPORTANT: This command loads an extra sprite into memory which is not controlled by the normal AGS sprite cache and will not be automatically disposed of. Therefore, when you are finished with the image you MUST call Delete on it to free its memory.

IMPORTANT: If the DynamicSprite instance is released from memory (ie. there is no longer a DynamicSprite* variable pointing to it), then the sprite will also be removed from memory. Make sure that you keep a global variable pointer to the sprite until you are finished with it, and at that point call Delete.

Example:

// at top of script, outside event functions
DynamicSprite *buttonSprite;  

// inside an event function buttonSprite = DynamicSprite.CreateFromScreenShot(80, 50); if (buttonSprite != null) { btnScrnshot.NormalGraphic = buttonSprite.Graphic; }

places a screen grab of the current game session onto btnScrnshot.

Once the GUI is disposed of, Delete should be called on the sprite.

See Also: DynamicSprite.Delete, Game.GetSaveSlotDescription, DynamicSprite.CreateFromFile, DynamicSprite.CreateFromSaveGame


User comments and notes
There are currently no user comments on this page.
The user comment facility is currently disabled.