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

CreateFromSaveGame

(Formerly known as LoadSaveSlotScreenshot, which is now obsolete)

static DynamicSprite* DynamicSprite.CreateFromSaveGame
                        (int saveSlot, int width, int height)
Loads the screenshot for save game SAVESLOT into memory, resizing it to WIDTH x HEIGHT.

Returns the DynamicSprite instance of the image if successful, or returns null if the screenshot could not be loaded (perhaps the save game didn't include one).

In order for this to work, the "Save screenshots in save games" option must be ticked in the main Game Settings pane.

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.CreateFromSaveGame(1, 50, 50); if (buttonSprite != null) { btnScrnshot.NormalGraphic = buttonSprite.Graphic; }

will load the screenshot for save game 1 and resize it to 50x50. It then places it onto the btnScrnshot GUI button.

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

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


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