background_flush

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

Syntax:

background_flush(ind);


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


Returns: N/A


Description

With this function you can remove the given background texture - and the texture page it is on - from video memory (the texture page will be reloaded on next use). You supply the background index (as defined when creating the background 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 background_prefetch on any required graphics at the start of a level to avoid any stalls.


Example:

background_flush(bck_Trees);

The above code flushes the background "bck_Trees" from memory.


Back: Backgrounds
Next: background_flush_multi
© Copyright YoYo Games Ltd. 2018 All Rights Reserved