Building Game Engines
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ResourceManager Class Reference

#include <ResourceManager.hpp>

Collaboration diagram for ResourceManager:
Collaboration graph

Public Member Functions

void Start (SDL_Renderer *m_renderer)
 
void Shutdown ()
 
void SaveState (const char *name)
 
void LoadEnemies (const char *filename)
 
void LoadCollectibles (const char *filename)
 
void AddGameObject (std::string name, GameObject *object)
 
GameObjectGetGameObject (std::string name)
 
std::unordered_map< std::string, GameObject * > GetGameObjects ()
 
void RemoveGameObject (std::string name)
 
void Input (SDL_Event e)
 
void PausedInput (SDL_Event e)
 
void Update ()
 
void PausedUpdate ()
 
void Render (SDL_Renderer *m_renderer)
 
GameObjectMakeEnemy (int x, int y, int range, int type)
 
GameObjectMakeFruit (int xpos, int ypos, int width, int height, int type)
 
void ChangePlaceWhat (int to)
 
void changeBlock (int valueBlock)
 
 ResourceManager ()
 

Static Public Member Functions

static ResourceManagerGetInstance ()
 

Public Attributes

int currentTile = 0
 
SDL_Renderer * the_renderer
 

Detailed Description

Manages all the resources in the game

Constructor & Destructor Documentation

◆ ResourceManager()

ResourceManager::ResourceManager ( )
inline

Member Function Documentation

◆ AddGameObject()

void ResourceManager::AddGameObject ( std::string  name,
GameObject object 
)

Adds a game object

◆ changeBlock()

void ResourceManager::changeBlock ( int  valueBlock)

Allows for the gui to edit what brick is being edited

◆ ChangePlaceWhat()

void ResourceManager::ChangePlaceWhat ( int  to)

◆ GetGameObject()

GameObject * ResourceManager::GetGameObject ( std::string  name)

Gets a game object

◆ GetGameObjects()

std::unordered_map<std::string, GameObject*> ResourceManager::GetGameObjects ( )

Gets all game objects

◆ GetInstance()

ResourceManager * ResourceManager::GetInstance ( )
static

Gets the instance of this resource manager (there can only be one)

Here is the call graph for this function:

◆ Input()

void ResourceManager::Input ( SDL_Event  e)

Processes input for all game objects

◆ LoadCollectibles()

void ResourceManager::LoadCollectibles ( const char *  filename)

Loads collectible information from a file.

Here is the call graph for this function:

◆ LoadEnemies()

void ResourceManager::LoadEnemies ( const char *  filename)

Loads enemy information from a file.

Here is the call graph for this function:

◆ MakeEnemy()

GameObject * ResourceManager::MakeEnemy ( int  x,
int  y,
int  range,
int  type 
)
Here is the call graph for this function:

◆ MakeFruit()

GameObject * ResourceManager::MakeFruit ( int  xpos,
int  ypos,
int  width,
int  height,
int  type 
)
Here is the call graph for this function:

◆ PausedInput()

void ResourceManager::PausedInput ( SDL_Event  e)

Processes input for the game while it is paused

Here is the call graph for this function:

◆ PausedUpdate()

void ResourceManager::PausedUpdate ( )

Updates the games information while paused

◆ RemoveGameObject()

void ResourceManager::RemoveGameObject ( std::string  name)

Removes the specified game object

◆ Render()

void ResourceManager::Render ( SDL_Renderer *  m_renderer)

Renders all game objects

Here is the call graph for this function:

◆ SaveState()

void ResourceManager::SaveState ( const char *  name)

Makes a save with the given save name

Here is the call graph for this function:

◆ Shutdown()

void ResourceManager::Shutdown ( )

Shuts down the resource manager by freeing all objects

Here is the call graph for this function:

◆ Start()

void ResourceManager::Start ( SDL_Renderer *  m_renderer)

Starts the resource manager by creating all objects

Here is the call graph for this function:

◆ Update()

void ResourceManager::Update ( )

Updates all game objects

Here is the call graph for this function:

Member Data Documentation

◆ currentTile

int ResourceManager::currentTile = 0

◆ the_renderer

SDL_Renderer* ResourceManager::the_renderer

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