Platformer
Platformer
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
GameManager Class Reference

This class manages the loading, rendering, and objects of our game as a singleton. More...

#include <GameManager.hpp>

Collaboration diagram for GameManager:
Collaboration graph

Public Member Functions

void init ()
 Initializes the GameManager.
 
void shutdown ()
 Shuts down the GameManager, removing its reference to the currently loaded GameWorld and all GameObjects contained within.
 
void LoadLevels ()
 Calls to parse the levels and sets shouldLoadLevel true.
 
void Update ()
 Updates the world and any other gameobjects controlled by the GameManager, and calls to load levels if prompted.
 
 GameManager (const GameManager &)=delete
 Stop the compiler from generating methods to copy the object.
 
GameManageroperator= (const GameManager &)=delete
 Stop the compiler from generating methods to copy the object.
 
void RegisterObject (std::shared_ptr< GameObject > obj, bool isPermanent)
 

Static Public Member Functions

static GameManagerinstance ()
 The singleton instance of the GameManager.
 
static void LoadNextLevel ()
 Increments the curLevel and sets shouldLoadLevel true.
 
static void ReloadLevel ()
 Reloads the level by setting shouldLoadLevel true.
 
static std::vector< std::shared_ptr< GameObject > > GetActiveObjects ()
 Gets the list of all active objects in our GameManager. More...
 

Private Member Functions

 GameManager ()
 Constructs a GameManager.
 
 ~GameManager ()
 Destructs a GameManager.
 
void LoadLevel (const std::string &path)
 Loads the given level path. More...
 

Private Attributes

std::shared_ptr< GameWorldcurWorld_
 The current world for our GameManager.
 
std::vector< std::shared_ptr< GameObject > > permanentObjs_
 The permanent objects in our GameManager.
 
std::vector< std::string > levelPaths
 The list of level paths for loading assets.
 
int curLevel
 The current level.
 
bool shouldLoadLevel
 Whether or not the GameManager should load the next level.
 

Detailed Description

This class manages the loading, rendering, and objects of our game as a singleton.

Member Function Documentation

◆ GetActiveObjects()

std::vector< std::shared_ptr< GameObject > > GameManager::GetActiveObjects ( )
static

Gets the list of all active objects in our GameManager.

Returns
The list of all active objects
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadLevel()

void GameManager::LoadLevel ( const std::string &  path)
private

Loads the given level path.

Parameters
pathThe path of the level to be loaded
Here is the call graph for this function:
Here is the caller graph for this function:

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