Class Engine::AssetManager¶
ClassList > Engine > AssetManager
Singleton class to load, store, and manage game audio assets.
#include <AssetManager.hpp>
Public Functions¶
| Type | Name |
|---|---|
| AssetManager () = default |
|
| AssetManager (const AssetManager &) = delete |
|
| AssetManager (AssetManager &&) = delete |
|
| void | ClearAll () |
| std::unordered_map< std::string, std::shared_ptr< Music > > & | GetAllMusic () |
| std::unordered_map< std::string, std::shared_ptr< Sound > > & | GetAllSounds () |
| std::shared_ptr< raylib::Font > | GetFont (const std::string & alias) |
| std::shared_ptr< Music > | GetMusic (const std::string & alias) |
| std::shared_ptr< Sound > | GetSound (const std::string & alias) |
| std::shared_ptr< Sprite > | GetSprite (const std::string & alias) Retrieves a sprite by its alias. |
| void | LoadFontFromMemory (const std::string & alias, const std::string & fileType, const unsigned char * fileData, int dataSize, int fontSize=12, int * fontChars=nullptr, int charsCount=0) |
| void | LoadMusic (const std::string & alias, const std::string & filePath, bool isLoop=false) Clears all loaded assets (sounds and sprites). |
| void | LoadMusicFromMemory (const std::string & alias, const char * fileType, const unsigned char * data, int dataSize, bool isLoop=false) |
| void | LoadSound (const std::string & alias, const std::string & filePath, bool isLoop=false) |
| void | LoadSoundFromMemory (const std::string & alias, const char * fileType, const unsigned char * data, int dataSize, bool isLoop=false) |
| void | LoadSprite (const std::string & alias, const std::string & filePath) Loads a sprite texture from a file path and assigns it an alias. |
| void | UnloadMusic (const std::string & alias) |
| void | UnloadSound (const std::string & alias) |
| void | UnloadSprite (const std::string & alias) Unloads a sprite and frees its resources. |
| AssetManager & | operator= (const AssetManager &) = delete |
| AssetManager & | operator= (AssetManager &&) = delete |
| ~AssetManager () |
Public Functions Documentation¶
function AssetManager [⅓]¶
function AssetManager [⅔]¶
function AssetManager [3/3]¶
function ClearAll¶
function GetAllMusic¶
inline std::unordered_map< std::string, std::shared_ptr< Music > > & Engine::AssetManager::GetAllMusic ()
function GetAllSounds¶
inline std::unordered_map< std::string, std::shared_ptr< Sound > > & Engine::AssetManager::GetAllSounds ()
function GetFont¶
function GetMusic¶
function GetSound¶
function GetSprite¶
Retrieves a sprite by its alias.
Parameters:
aliasThe unique identifier for the sprite.
Returns:
Reference to the Sprite object.
Exception:
- ErrorAsset if the sprite alias is not found.
function LoadFontFromMemory¶
void Engine::AssetManager::LoadFontFromMemory (
const std::string & alias,
const std::string & fileType,
const unsigned char * fileData,
int dataSize,
int fontSize=12,
int * fontChars=nullptr,
int charsCount=0
)
Parameters:
aliasname to be used to retrieve this fontfileTypeExtension of the file like '.tff'fileDatathe font file itselfdataSizethe size of data to loadfontSizethe base size of the fontfontCharsIn case we need to load more letters than ASCII like for example Ñ. If its nullptr it will load only ASCIIcharsCountthe number of elements to load from fontChars
function LoadMusic¶
Clears all loaded assets (sounds and sprites).
void Engine::AssetManager::LoadMusic (
const std::string & alias,
const std::string & filePath,
bool isLoop=false
)
function LoadMusicFromMemory¶
void Engine::AssetManager::LoadMusicFromMemory (
const std::string & alias,
const char * fileType,
const unsigned char * data,
int dataSize,
bool isLoop=false
)
function LoadSound¶
void Engine::AssetManager::LoadSound (
const std::string & alias,
const std::string & filePath,
bool isLoop=false
)
function LoadSoundFromMemory¶
void Engine::AssetManager::LoadSoundFromMemory (
const std::string & alias,
const char * fileType,
const unsigned char * data,
int dataSize,
bool isLoop=false
)
function LoadSprite¶
Loads a sprite texture from a file path and assigns it an alias.
Parameters:
aliasThe unique identifier for the sprite.filePathThe file path to the image file.
function UnloadMusic¶
function UnloadSound¶
function UnloadSprite¶
Unloads a sprite and frees its resources.
Parameters:
aliasThe unique identifier for the sprite.
function operator=¶
function operator=¶
function ~AssetManager¶
The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Assets/AssetManager.hpp