Angel 3.2
A 2D Game Prototyping Engine
Public Member Functions | List of all members
GameManager Class Reference

A class to oversee the high-level aspects of your game. More...

#include <GameManager.h>

+ Inheritance diagram for GameManager:

Public Member Functions

 GameManager ()
 ~GameManager ()
virtual void Render ()
virtual void Update (float dt)
virtual bool IsProtectedFromUnloadAll (Renderable *renderable)
virtual void ReceiveMessage (Message *message)
virtual void SoundEnded (AngelSoundHandle sound)
- Public Member Functions inherited from Renderable
 Renderable ()
virtual ~Renderable ()
void Destroy ()
bool IsDestroyed ()
int GetLayer ()

Additional Inherited Members

- Protected Member Functions inherited from Renderable
virtual void PreDestroy ()
- Protected Attributes inherited from Renderable
bool _deleteMe
int _layer

Detailed Description

Oftentimes you want to have a central class that handles game-flow. Things like keeping score, managing the creation of new Actors, etc. You could do this with a centralized Actor that doesn't get drawn, but there's a lot of functionality (baggage) on the Actor class that you wouldn't be using in that case.

The GameManager class is a Renderable, so it will get all the Render and Update calls that an Actor would receive. You register it with your World (via the theWorld.SetGameManager function) and can then retrieve it from anywhere in your game.

Definition at line 49 of file GameManager.h.

Constructor & Destructor Documentation

GameManager::GameManager ( )

The default constructor is empty; we expect you to subclass to do anything meaningful.

Definition at line 56 of file GameManager.h.

GameManager::~GameManager ( )

The destructor makes sure that the GameManager unsubscribes from all Message notifications.

Definition at line 43 of file GameManager.cpp.

Member Function Documentation

void GameManager::Render ( )

Override of the Renderable::Render function. Doesn't do anything in this base class.

Reimplemented from Renderable.

Definition at line 39 of file GameManager.cpp.

void GameManager::Update ( float  dt)

Override of the Renderable::Update function. Also doesn't do anything in the base class, but in the future it might, so make sure you call this in any override implementations.

dtThe amount of time elapsed since the start of the last frame.

Reimplemented from Renderable.

Definition at line 35 of file GameManager.cpp.

virtual bool GameManager::IsProtectedFromUnloadAll ( Renderable renderable)

In your GameManager, you can define a custom function to determine whether specific Renderables should be protected from the World::UnloadAll function. This function will get called for each Renderable during an UnloadAll attempt.

renderableThe Renderable to test
Whether it should be protected (returning false means it will be removed from the world)

Definition at line 89 of file GameManager.h.

virtual void GameManager::ReceiveMessage ( Message message)

Override of the MessageListener::ReceiveMessage function. Does nothing in this base class.

messageThe received message.

Implements MessageListener.

Definition at line 97 of file GameManager.h.

virtual void GameManager::SoundEnded ( AngelSoundHandle  sound)

The sound system needs a callback that gets triggered when any sound ends. Since the GameManager is a logical place to have sound control functionality, it has this function for you to implement.

soundThe handle to the sound that has just completed.

Definition at line 106 of file GameManager.h.

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