Game Engine 2D Platformer
Public Member Functions | Static Public Member Functions | List of all members
ResourceManager Class Reference

The resource manager is responsible for handling and managing resources regarding the game. More...

#include <ResourceManager.hpp>

Public Member Functions

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...
 

Static Public Member Functions

static ResourceManagergetInstance ()
 Method used to get instance of ResourceManager class. More...
 

Detailed Description

The resource manager is responsible for handling and managing resources regarding the game.

Member Function Documentation

◆ getInstance()

ResourceManager & ResourceManager::getInstance ( )
static

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
phraseThe 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
filePathpath 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
filePathpath 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
filePathpath 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
filePathpath 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
filePathpath 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
languageCode1 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
englishthe english word
frenchIt's french counterpart

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