Namespace P64::AssetManager

Functions

void P64::AssetManager::init()
void P64::AssetManager::freeAll()

Frees all currently loaded assets.

This should never be called manually, and is done automatically during a scene change.

void *P64::AssetManager::getByIndex(uint32_t idx)

Returns an asset handle by its asset-index.

Internally a table is used to prevent loading the same asset multiple time. So this function will cause a load if not already loaded, and return the same point on subsequent calls. During a scene-transition, all assets will be freed, so don’t keep any pointers around between scenes.

The index can be determined at build time with the provided ‘_asset’ suffix for string. For example: logoPyrite = (sprite_t*)AssetManager::getByIndex(“ui/logoPyrite.sprite”_asset);

Parameters:

idx – index, the _asset suffix can be used

Returns:

pointer to asset, nullptr if not found

const char *P64::AssetManager::getPathByIndex(uint32_t idx)