NWengine 0.9
Loading...
Searching...
No Matches
Asset Class Reference

The base class for all assets. More...

#include <Asset.h>

Inheritance diagram for Asset:
Font Image Shader Sound Texture

Public Member Functions

virtual AssetGetFromCache (void *identifier)
 Get the asset from the cache based on the identifier.
 
virtual AssetLoadFromFileOrGetFromCache (void *identifier, const char *path, void *data)
 Load the asset from file or get it from the cache based on the identifier and file path.
 
virtual AssetLoadFromFile (const char *path, void *data=nullptr)
 Load the asset from file based on the file path.
 
virtual AssetLoadFromBuffer (void *buffer, void *data)
 Load the asset from a buffer.
 
virtual AssetLoadFromBufferOrGetFromCache (void *identifier, void *buffer, void *data)
 Load the asset from a buffer or get it from the cache based on the identifier.
 
virtual void Clean ()
 Clean up the asset.
 

Public Attributes

int _usageCounter = 0
 

Detailed Description

The base class for all assets.

Member Function Documentation

◆ Clean()

void Asset::Clean ( )
virtual

Clean up the asset.

Reimplemented in Sound, Font, Texture, and Image.

◆ GetFromCache()

Asset * Asset::GetFromCache ( void * identifier)
virtual

Get the asset from the cache based on the identifier.

Parameters
identifierThe identifier of the asset.
Returns
The asset from the cache.

Reimplemented in Sound, Font, Shader, and Texture.

◆ LoadFromBuffer()

Asset * Asset::LoadFromBuffer ( void * buffer,
void * data )
virtual

Load the asset from a buffer.

Parameters
bufferThe buffer containing the asset data.
dataAdditional data for loading the asset.
Returns
The loaded asset.

Reimplemented in Sound, Texture, Font, and Shader.

◆ LoadFromBufferOrGetFromCache()

Asset * Asset::LoadFromBufferOrGetFromCache ( void * identifier,
void * buffer,
void * data )
virtual

Load the asset from a buffer or get it from the cache based on the identifier.

Parameters
identifierThe identifier of the asset.
bufferThe buffer containing the asset data.
dataAdditional data for loading the asset.
Returns
The loaded asset.

◆ LoadFromFile()

Asset * Asset::LoadFromFile ( const char * path,
void * data = nullptr )
virtual

Load the asset from file based on the file path.

Parameters
pathThe file path of the asset.
dataAdditional data for loading the asset.
Returns
The loaded asset.

Reimplemented in Texture, Font, Sound, Shader, and Image.

◆ LoadFromFileOrGetFromCache()

Asset * Asset::LoadFromFileOrGetFromCache ( void * identifier,
const char * path = nullptr,
void * data = nullptr )
virtual

Load the asset from file or get it from the cache based on the identifier and file path.

Parameters
identifierThe identifier of the asset.
pathThe file path of the asset.
dataAdditional data for loading the asset.
Returns
The loaded asset.

The documentation for this class was generated from the following files: