asset::AssetLoader
Last updated
Last updated
#include <AssetLoader.hpp>
~AssetLoader() =default
template <class... Args> void
(const std::string & key, const std::filesystem::path & path, std::string_view next, Args... args) load an SFML asset and add it to the map
void
(const std::string & key, std::vector< std::string > paths)
template <class... Args> void
(const std::string & key, const std::filesystem::path & path, std::string_view next, Args... args) Load a background music and add it to the map.
void
(const std::string & key, std::vector< std::string > paths)
template <class... Args> void
(const std::string & key, const std::filesystem::path & path, std::string_view next, Args... args) Load a sound effect and add it to the map.
void
(const std::string & key, std::vector< std::string > paths)
template <class... Args> void
(const std::string & key, const std::filesystem::path & path, std::string_view next, Args... args) load a font and add it to the map
void
(const std::string & key, std::vector< std::string > paths)
void
(const std::string & action, const std::string & key)
std::filesystem::path
(std::vector< std::string > paths) create a smartpath from a vector of string
sf::Texture &
(const std::string & key) Get an Asset object from the map.
sf::Music &
(const std::string & key) Get a background music object from the map.
sf::Sound &
(const std::string & key) Get a sound effect object from the map.
sf::Font &
(const std::string & key) Get a font object from the mapb.
sf::Keyboard::Key &
(const std::string & key)
void
(const std::filesystem::path & path) Load a .ini file with boost loading assets into the map.
&
()
std::filesystem::path
(std::filesystem::path path)
template <class... Args> std::filesystem::path
(std::filesystem::path path, std::string_view next, Args... args)
void
()
class asset::AssetLoader;
This class loads all the assets neened by the game and stores them in a map Basic operatations on assets are supported An asset is either a texture, a sound or a font
~AssetLoader() =default
Destroy the AssetLoader object
template <class... Args>
static inline void LoadTexture(
const std::string & key,
const std::filesystem::path & path,
std::string_view next,
Args... args
)
load an SFML asset and add it to the map
Parameters:
key the key to load the asset
path first segment of the path of the asset
next next segment of the path of the asset
args other segments of the path
static inline void LoadTexture(
const std::string & key,
std::vector< std::string > paths
)
template <class... Args>
static inline void LoadBGM(
const std::string & key,
const std::filesystem::path & path,
std::string_view next,
Args... args
)
Load a background music and add it to the map.
Parameters:
key the key to load the asset
path first segment of the path of the asset
next next segment of the path of the asset
args other segments of the path
Template Parameters:
Args Path segments
static inline void LoadBGM(
const std::string & key,
std::vector< std::string > paths
)
template <class... Args>
static inline void LoadSFX(
const std::string & key,
const std::filesystem::path & path,
std::string_view next,
Args... args
)
Load a sound effect and add it to the map.
Parameters:
key the key to load the asset
path first segment of the path of the asset
next next segment of the path of the asset
args other segments of the path
Template Parameters:
Args Path segments
static inline void LoadSFX(
const std::string & key,
std::vector< std::string > paths
)
template <class... Args>
static inline void LoadFont(
const std::string & key,
const std::filesystem::path & path,
std::string_view next,
Args... args
)
load a font and add it to the map
Parameters:
key the key to load the font
path first segment of the path of the font
next next segment of the path of the font
args other segments of the path
static inline void LoadFont(
const std::string & key,
std::vector< std::string > paths
)
static inline void loadKeybind(
const std::string & action,
const std::string & key
)
static inline std::filesystem::path smartPath(
std::vector< std::string > paths
)
create a smartpath from a vector of string
static inline sf::Texture & GetTexture(
const std::string & key
)
Get an Asset object from the map.
Parameters:
key of the asset to get
Return: sf::Texture& the texture
static inline sf::Music & GetBGM(
const std::string & key
)
Get a background music object from the map.
Parameters:
key of the asset to get
Return: sf::Music& the music
static inline sf::Sound & GetSFX(
const std::string & key
)
Get a sound effect object from the map.
Parameters:
key of the asset to get
Return: sf::Sound& the sound effect
static inline sf::Font & GetFont(
const std::string & key
)
Get a font object from the mapb.
Parameters:
key of the asset to get
Return: sf::Font& the font
static inline sf::Keyboard::Key & GetKeybind(
const std::string & key
)
static inline void LoadIniFile(
const std::filesystem::path & path
)
Load a .ini file with boost loading assets into the map.
static AssetLoader & getInstance()
the instance of the AssetLoader object
static inline std::filesystem::path smartPath(
std::filesystem::path path
)
template <class... Args>
static inline std::filesystem::path smartPath(
std::filesystem::path path,
std::string_view next,
Args... args
)
static inline void display_key_from_map()
Updated on 2022-11-13 at 17:21:37 +0100