Dragonfly 4.20
A text-based game engine
|
Public Member Functions | |
int | startUp () override |
void | shutDown () override |
int | loadSprite (std::string filename, std::string label) |
int | unloadSprite (std::string label) |
Sprite * | getSprite (std::string label) const |
int | loadSound (std::string filename, std::string label) |
int | unloadSound (std::string label) |
Sound * | getSound (std::string label) |
int | loadMusic (std::string filename, std::string label) |
int | unloadMusic (std::string label) |
Music * | getMusic (std::string label) |
Public Member Functions inherited from df::Manager | |
std::string | getType () const |
virtual int | startUp () |
virtual void | shutDown () |
bool | isStarted () const |
int | onEvent (const Event *p_event) const |
int | registerInterest (Object *p_o, std::string event_type) |
int | unregisterInterest (Object *p_o, std::string event_type) |
Static Public Member Functions | |
static ResourceManager & | getInstance () |
Private Member Functions | |
ResourceManager (ResourceManager const &) | |
void | operator= (ResourceManager const &) |
ResourceManager () | |
Sprite * | loadRobustSprite (std::ifstream *p_file) |
Sprite * | loadSimpleSprite (std::ifstream *p_file) |
Private Attributes | |
Sprite * | m_p_sprite [MAX_SPRITES] |
int | m_sprite_count |
Sound | m_sound [MAX_SOUNDS] |
int | m_sound_count |
Music | m_music [MAX_MUSICS] |
int | m_music_count |
Additional Inherited Members | |
Protected Member Functions inherited from df::Manager | |
void | setType (std::string new_type) |
|
private |
Don't allow copy.
|
private |
Private since a singleton.
|
static |
Get the one and only instance of the ResourceManager.
Music * df::ResourceManager::getMusic | ( | std::string | label | ) |
Find Music with indicated label.
Return pointer to it if found, else NULL.
Sound * df::ResourceManager::getSound | ( | std::string | label | ) |
Find Sound with indicated label.
Return pointer to it if found, else NULL.
Sprite * df::ResourceManager::getSprite | ( | std::string | label | ) | const |
Find Sprite with indicated label.
Return pointer to it if found, else NULL.
int df::ResourceManager::loadMusic | ( | std::string | filename, |
std::string | label | ||
) |
Associate file with Music.
Return 0 if ok, else -1.
int df::ResourceManager::loadSound | ( | std::string | filename, |
std::string | label | ||
) |
Load sound from file.
Return 0 if ok, else -1.
int df::ResourceManager::loadSprite | ( | std::string | filename, |
std::string | label | ||
) |
|
private |
Don't allow assignment.
|
overridevirtual |
Shut down manager, freeing up any allocated Sprites, Music and Sounds.
Reimplemented from df::Manager.
|
overridevirtual |
Get ResourceManager ready to manage resources.
Reimplemented from df::Manager.
int df::ResourceManager::unloadMusic | ( | std::string | label | ) |
Remove label for Music with indicated label.
Return 0 if ok, else -1.
int df::ResourceManager::unloadSound | ( | std::string | label | ) |
Remove Sound with indicated label.
Return 0 if ok, else -1.
int df::ResourceManager::unloadSprite | ( | std::string | label | ) |
Unload Sprite with indicated label.
Return 0 if ok, else -1.
|
private |
Array of music buffers.
|
private |
Count of number of loaded musics.
|
private |
Array of (pointers to) Sprites.
|
private |
Array of sound buffers.
|
private |
Count of number of loaded sounds.
|
private |
Count of number of loaded sprites.