sprite_flush

Flush a sprite asset (and the texture page it's on) from memory.

Syntax:

sprite_flush(ind);


Argument Description
ind The index (resource name) of the sprite asset to flush


Returns: N/A


Description

With this function you can remove the given sprite texture - and the texture page it is on - from video memory (the texture page will be reloaded on next use). You supply the sprite index (as defined when creating the sprite resource) and it will be removed from the texture memory. It is worth noting that by default on the Windows platforms (YYC and standard) all textures will always be loaded into memory on start-up. If you are making a cross platform game, then you can leave this function in your code for the Windows target as it will not give any error and just not do anything. However you can also force the Windows target to not load any textures on startup and so use the flush and prefetch functions as you would on all other platforms (the setting can be found in the Windows Global Game Settings window).

NOTE: There is a performance hit as the texture is uploaded to texture memory on most devices, so you can call sprite_prefetch on any required graphics at the start of a level to avoid any stalls.


Example:

sprite_flush(spr_Player_Aura);

The above code flushes the sprite "spr_Player_Aura" from memory.


Back: Sprites
Next: sprite_flush_multi
© Copyright YoYo Games Ltd. 2018 All Rights Reserved