#include <Game.h>
Collaboration diagram for ASR::Game:
Public Member Functions | |
Game (SceneManager *sceneMgr, RenderWindow *win) | |
~Game () | |
SceneManager * | getSceneManager () const |
Grab the SceneManager. | |
Level * | createLevel () |
Start up a new level. | |
Level * | getLevel () const |
Retrieves the current level. | |
void | destroyLevel () |
Destroys the current level. | |
void | addUpdater (Updater *updater) |
Registers a new Updater with the system. | |
Static Public Member Functions | |
static Game & | getSingleton (void) |
Override standard Singleton retrieval. | |
static Game * | getSingletonPtr (void) |
Override standard Singleton retrieval. | |
Private Attributes | |
Level * | mLevel |
GameListener * | mListener |
SceneManager * | mSceneMgr |
RenderWindow * | mWindow |
Definition at line 20 of file Game.h.
ASR::Game::Game | ( | SceneManager * | sceneMgr, | |
RenderWindow * | win | |||
) |
ASR::Game::~Game | ( | ) |
Definition at line 29 of file Game.cpp.
References destroyLevel().
00030 { 00031 destroyLevel (); 00032 }
void ASR::Game::addUpdater | ( | Updater * | updater | ) |
Registers a new Updater with the system.
Updaters are called in the order they are added
Definition at line 96 of file Game.cpp.
References ASR::GameListener::addUpdater(), and mListener.
Referenced by ASR::Client::createCamera(), ASR::Client::createTeam(), and ASR::Team::Team().
00097 { 00098 OgreAssert ( mListener != NULL, "Listener has not been created - Game::addUpdater" ); 00099 mListener->addUpdater ( updater ); 00100 }
Level * ASR::Game::createLevel | ( | ) |
Start up a new level.
Definition at line 47 of file Game.cpp.
References mLevel, mListener, and mWindow.
Referenced by TutorialApplication::chooseSceneManager().
00048 { 00049 if ( mLevel != NULL ) 00050 throw Exception ( Exception::ERR_DUPLICATE_ITEM, "Level already created", "Game::createLevel" ); 00051 00052 if ( mListener != NULL ) 00053 throw Exception ( Exception::ERR_DUPLICATE_ITEM, "There is already an existing Listener", "Game::createLevel" ); 00054 00055 mListener = new GameListener ( mWindow ); 00056 Ogre::Root::getSingleton().addFrameListener( mListener ); 00057 00058 mLevel = new Level (); 00059 return mLevel; 00060 }
void ASR::Game::destroyLevel | ( | ) |
Destroys the current level.
Definition at line 81 of file Game.cpp.
References mLevel, and mListener.
Referenced by ~Game().
00082 { 00083 if ( mLevel == NULL ) 00084 throw Exception ( Exception::ERR_ITEM_NOT_FOUND, "Level does not exist", "Game::getLevel" ); 00085 00086 Ogre::Root::getSingleton().removeFrameListener ( mListener ); 00087 delete mListener; 00088 mListener = NULL; 00089 00090 delete mLevel; 00091 mLevel = NULL; 00092 }
Level * ASR::Game::getLevel | ( | ) | const |
SceneManager * ASR::Game::getSceneManager | ( | ) | const |
Grab the SceneManager.
Definition at line 64 of file Game.cpp.
References mSceneMgr.
Referenced by ASR::Projectile::_destroyEntity(), ASR::Projectile::_generateEntity(), ASR::UnitSelecter::_selectUnits(), ASR::Building::Building(), ASR::TeamBuildings::TeamBuildings(), ASR::TeamUnits::TeamUnits(), ASR::UnitSelecter::UnitSelecter(), ASR::TeamUnits::~TeamUnits(), and ASR::UnitSelecter::~UnitSelecter().
00065 { 00066 return mSceneMgr; 00067 }
Game & ASR::Game::getSingleton | ( | void | ) | [static] |
Override standard Singleton retrieval.
Definition at line 40 of file Game.cpp.
Referenced by ASR::Client::_createGUI(), ASR::Projectile::_destroyEntity(), ASR::Projectile::_generateEntity(), ASR::Client::createCamera(), ASR::Client::createTeam(), ASR::Team::Team(), and ASR::UnitSelecter::UnitSelecter().
Game * ASR::Game::getSingletonPtr | ( | void | ) | [static] |
Override standard Singleton retrieval.
Definition at line 36 of file Game.cpp.
Referenced by ASR::UnitSelecter::_selectUnits(), ASR::Building::Building(), ASR::TeamBuildings::TeamBuildings(), ASR::TeamUnits::TeamUnits(), ASR::TeamUnits::~TeamUnits(), and ASR::UnitSelecter::~UnitSelecter().
Level* ASR::Game::mLevel [private] |
Definition at line 25 of file Game.h.
Referenced by createLevel(), destroyLevel(), Game(), and getLevel().
GameListener* ASR::Game::mListener [private] |
Definition at line 26 of file Game.h.
Referenced by addUpdater(), createLevel(), destroyLevel(), and Game().
SceneManager* ASR::Game::mSceneMgr [private] |
RenderWindow* ASR::Game::mWindow [private] |