HeadBall  1.0
A game
Public Member Functions | Private Attributes | List of all members
HeadBall::AssetManager Class Reference

Class for managing assets. More...

#include <AssetManager.hpp>

Collaboration diagram for HeadBall::AssetManager:
Collaboration graph

Public Member Functions

 AssetManager ()
 Construct a new Asset Manager object. More...
 
 ~AssetManager ()
 Destroy the Asset Manager object. More...
 
void loadTexture (std::string name, std::string fileName)
 Load Texture from given file into map More...
 
sf::Texture & getTexture (std::string name)
 Get the Texture object. More...
 
void loadFont (std::string name, std::string fileName)
 Load Font from given file into map More...
 
sf::Font & getFont (std::string name)
 Get the Font object. More...
 
void loadSound (std::string name, std::string fileName)
 Load Sound from given file into map More...
 
sf::SoundBuffer & getSound (std::string name)
 Get the Sound object. More...
 
bool isTexturePresent (std::string textureName)
 Check whether the Texture is present in map More...
 
bool isFontPresent (std::string fontName)
 Check whether the Font is present in map More...
 
bool isSoundPresent (std::string soundName)
 Check whether the Sound is present in map More...
 

Private Attributes

std::map< std::string, sf::Texture > _textures
 map for storing Textures More...
 
std::map< std::string, sf::Font > _fonts
 map for storing Fonts More...
 
std::map< std::string, sf::SoundBuffer > _sound_clips
 map for storing Sound clips/Sound effects More...
 

Detailed Description

Class for managing assets.

Assets managed by this class include Textures, Fonts and Sound.

Constructor & Destructor Documentation

◆ AssetManager()

HeadBall::AssetManager::AssetManager ( )
inline

Construct a new Asset Manager object.

◆ ~AssetManager()

HeadBall::AssetManager::~AssetManager ( )
inline

Destroy the Asset Manager object.

Member Function Documentation

◆ getFont()

sf::Font & HeadBall::AssetManager::getFont ( std::string  name)

Get the Font object.

Parameters
nameName of Font object
Returns
sf::Font& Reference to Font object

◆ getSound()

sf::SoundBuffer & HeadBall::AssetManager::getSound ( std::string  name)

Get the Sound object.

Parameters
nameName of Sound object
Returns
sf::SoundBuffer& Reference to Sound object

◆ getTexture()

sf::Texture & HeadBall::AssetManager::getTexture ( std::string  name)

Get the Texture object.

Parameters
nameName of Texture object
Returns
sf::Texture& Reference to Texture object

◆ isFontPresent()

bool HeadBall::AssetManager::isFontPresent ( std::string  fontName)

Check whether the Font is present in map

Parameters
fontNameName of Font object
Returns
true if Font is present
false if Font is not present

◆ isSoundPresent()

bool HeadBall::AssetManager::isSoundPresent ( std::string  soundName)

Check whether the Sound is present in map

Parameters
soundNameName of Sound object
Returns
true if Sound is present
false if Sound is not present

◆ isTexturePresent()

bool HeadBall::AssetManager::isTexturePresent ( std::string  textureName)

Check whether the Texture is present in map

Parameters
textureNameName of Texture object
Returns
true if Texture is present
false if Texture is not present

◆ loadFont()

void HeadBall::AssetManager::loadFont ( std::string  name,
std::string  fileName 
)

Load Font from given file into map

Parameters
nameName of the Font object
fileNamePath to Font

◆ loadSound()

void HeadBall::AssetManager::loadSound ( std::string  name,
std::string  fileName 
)

Load Sound from given file into map

Parameters
nameName of Sound object
fileNamePath to Sound

◆ loadTexture()

void HeadBall::AssetManager::loadTexture ( std::string  name,
std::string  fileName 
)

Load Texture from given file into map

Parameters
nameName of Texture object
fileNamePath to Texture

Member Data Documentation

◆ _fonts

std::map<std::string, sf::Font> HeadBall::AssetManager::_fonts
private

map for storing Fonts

◆ _sound_clips

std::map<std::string, sf::SoundBuffer> HeadBall::AssetManager::_sound_clips
private

map for storing Sound clips/Sound effects

◆ _textures

std::map<std::string, sf::Texture> HeadBall::AssetManager::_textures
private

map for storing Textures


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