StevEngine
StevEngine is a customizable C++ game engine.
Loading...
Searching...
No Matches
StevEngine::Resources::ResourceManager Class Reference

Manages loading and access to game resources. More...

#include <main/ResourceManager.hpp>

Public Member Functions

const ResourceGetFile (unsigned short id) const
 Get resource by ID.
 
const ResourceGetFile (std::string path) const
 Get resource by path.
 
void AddFile (std::string path, const char *data, const int size)
 Add resource from raw data.
 
template<int hexSize = 2>
void AddFileFromHex (std::string path, const char *hex, const int size)
 Add resource from hex string data.
 

Detailed Description

Manages loading and access to game resources.

Handles loading and caching of resource files like textures, models, audio etc. Resources can be accessed by ID or path.

Member Function Documentation

◆ AddFile()

void StevEngine::Resources::ResourceManager::AddFile ( std::string path,
const char * data,
const int size )

Add resource from raw data.

Parameters
pathVirtual path for resource
dataRaw data bytes
sizeSize of data in bytes

◆ AddFileFromHex()

template<int hexSize>
void StevEngine::Resources::ResourceManager::AddFileFromHex ( std::string path,
const char * hex,
const int size )

Add resource from hex string data.

Template Parameters
hexSizeSize of hex values (usually 2)
Parameters
pathVirtual path for resource
hexHex string data
sizeSize of final data in bytes

◆ GetFile() [1/2]

const Resource & StevEngine::Resources::ResourceManager::GetFile ( std::string path) const

Get resource by path.

Parameters
pathResource file path
Returns
Reference to resource
Exceptions
Errorif resource not found

◆ GetFile() [2/2]

const Resource & StevEngine::Resources::ResourceManager::GetFile ( unsigned short id) const

Get resource by ID.

Parameters
idResource identifier
Returns
Reference to resource
Exceptions
Errorif resource not found

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