The resource manager is responsible for handling and managing resources regarding the game.
More...
#include <ResourceManager.hpp>
|
SDL_Texture * | loadTexture (std::string filePath, SDL_Renderer *renderer) |
| Method used to load Spritesheet of Images from their path. More...
|
|
SDL_Surface * | loadSurface (std::string filePath, SDL_Renderer *renderer) |
| Method used to load Spritesheet of Images from their path. More...
|
|
TTF_Font * | loadFont (std::string filePath, int fontSize) |
| Method used to load TTF_Font object of respective font from its path. More...
|
|
Mix_Music * | loadMusic (std::string filePath) |
| Method used to load Mix_Music object of respective music from its path. More...
|
|
Mix_Chunk * | loadWAV (std::string filePath) |
| Method used to load Mix_Chunk object of respective music from its path. More...
|
|
void | setWords (std::string english, std::string french) |
| Metohd used to set translation words in LanguageMap. More...
|
|
std::string | getWords (std::string phrase) |
| Method used to get words based on the language, i.e English or French. More...
|
|
void | setLanguage (int languageCode) |
| Method to set language so other methods can know which language phrase to return. More...
|
|
void | loadWords () |
| Method to load the words from multiple scripts in the script folder. More...
|
|
The resource manager is responsible for handling and managing resources regarding the game.
◆ getInstance()
Method used to get instance of ResourceManager class.
- Returns
- static instance of Resource Manager class
◆ getWords()
std::string ResourceManager::getWords |
( |
std::string |
phrase | ) |
|
Method used to get words based on the language, i.e English or French.
- Parameters
-
phrase | The english phrase/words |
- Returns
- Either a French Phrase or an English Phrase based on the language selected
◆ loadFont()
TTF_Font * ResourceManager::loadFont |
( |
std::string |
filePath, |
|
|
int |
fontSize |
|
) |
| |
Method used to load TTF_Font object of respective font from its path.
- Parameters
-
filePath | path where font is stored |
- Returns
- TTF_Font object of respective font
◆ loadMusic()
Mix_Music * ResourceManager::loadMusic |
( |
std::string |
filePath | ) |
|
Method used to load Mix_Music object of respective music from its path.
- Parameters
-
filePath | path where music is stored |
- Returns
- Mix_Music object of respective music
◆ loadSurface()
SDL_Surface * ResourceManager::loadSurface |
( |
std::string |
filePath, |
|
|
SDL_Renderer * |
renderer |
|
) |
| |
Method used to load Spritesheet of Images from their path.
- Parameters
-
filePath | path where image is stored |
- Returns
- Spritesheet of respective image in the form of SDL_Surface*
◆ loadTexture()
SDL_Texture * ResourceManager::loadTexture |
( |
std::string |
filePath, |
|
|
SDL_Renderer * |
renderer |
|
) |
| |
Method used to load Spritesheet of Images from their path.
- Parameters
-
filePath | path where image is stored |
- Returns
- Spritesheet of respective image in the form of SDL_Surface*
◆ loadWAV()
Mix_Chunk * ResourceManager::loadWAV |
( |
std::string |
filePath | ) |
|
Method used to load Mix_Chunk object of respective music from its path.
- Parameters
-
filePath | path where music is stored |
- Returns
- Mix_Chunk object of respective music
◆ loadWords()
void ResourceManager::loadWords |
( |
| ) |
|
Method to load the words from multiple scripts in the script folder.
Right now only English and French is supported
◆ setLanguage()
void ResourceManager::setLanguage |
( |
int |
languageCode | ) |
|
Method to set language so other methods can know which language phrase to return.
- Parameters
-
languageCode | 1 for english and 0 for french |
◆ setWords()
void ResourceManager::setWords |
( |
std::string |
english, |
|
|
std::string |
french |
|
) |
| |
Metohd used to set translation words in LanguageMap.
- Parameters
-
english | the english word |
french | It's french counterpart |
The documentation for this class was generated from the following files: