Struct AssetRef

Wrapper for assets to enable auto-loading and setting it in the editor.

template<typename T>
struct AssetRef

Wrapper for assets to enable auto-loading and setting it in the editor.

This does not create any overhead in size, as a the pointer is used to store either the index (if < 0xFFFF) or the actual pointer.

The first call to get() will resolve the index to a pointer.

Template Parameters:

T – asset type (e.g. sprite_t)

Public Functions

inline T *get()

Getter that auto-loads the asset if needed.

Returns:

pointer to the asset

Public Members

T *ptr = {}