#include <src/core/Game.h>
Public Member Functions | |
void | addTickTime (uint32_t length) |
Game (int argc, char **argv) | |
Non-initialising constructor. | |
float | getAvgFPS () |
float | getAvgTickTime () |
const Clock & | getGameClock () |
GameState * | getState (const std::string &name) |
void | popState () |
void | requestState (const std::string &name) |
void | requestStates (const std::string &names) |
void | run () |
Main loop of the orxonox game. | |
void | setStateHierarchy (const std::string &str) |
void | stop () |
~Game () | |
Static Public Member Functions | |
template<class T> | |
static bool | declareGameState (const std::string &className, const std::string &stateName, bool bIgnoreTickTime, bool bConsoleMode) |
static Game & | getInstance () |
Private Member Functions | |
Game (Game &) | |
void | loadState (GameState *state) |
void | unloadState (GameState *state) |
Private Attributes | |
boost::shared_ptr < GameStateTreeNode > | activeStateNode_ |
std::vector< GameState * > | activeStates_ |
float | avgFPS_ |
float | avgTickTime_ |
bool | bAbort_ |
bool | bChangingState_ |
GameConfiguration * | configuration_ |
Core * | core_ |
Clock * | gameClock_ |
std::map< std::string, GameState * > | gameStates_ |
uint32_t | periodTickTime_ |
uint32_t | periodTime_ |
std::vector< boost::shared_ptr < GameStateTreeNode > > | requestedStateNodes_ |
boost::shared_ptr < GameStateTreeNode > | rootStateNode_ |
uint64_t | statisticsStartTime_ |
std::list< StatisticsTickInfo > | statisticsTickTimes_ |
Static Private Attributes | |
static std::map< std::string, GameStateInfo > | gameStateDeclarations_s |
static Game * | singletonRef_s = 0 |
Pointer to the Singleton. | |
Classes | |
class | GameStateFactory |
struct | GameStateInfo |
struct | StatisticsTickInfo |
class | TemplateGameStateFactory |
orxonox::Game::Game | ( | int | argc, | |
char ** | argv | |||
) |
Non-initialising constructor.
References activeStateNode_, activeStates_, avgFPS_, avgTickTime_, bAbort_, bChangingState_, configuration_, core_, COUT, orxonox::Game::GameStateFactory::fabricate(), gameClock_, gameStateDeclarations_s, gameStates_, orxonox::getLowercase(), getState(), periodTickTime_, periodTime_, rootStateNode_, singletonRef_s, statisticsStartTime_, and statisticsTickTimes_.
orxonox::Game::~Game | ( | ) |
References configuration_, orxonox::Game::GameStateFactory::destroyFactories(), and gameStates_.
orxonox::Game::Game | ( | Game & | ) | [private] |
void orxonox::Game::addTickTime | ( | uint32_t | length | ) |
References periodTickTime_, and statisticsTickTimes_.
Referenced by run(), orxonox::GSRoot::update(), and orxonox::GSGraphics::update().
bool orxonox::Game::declareGameState | ( | const std::string & | className, | |
const std::string & | stateName, | |||
bool | bIgnoreTickTime, | |||
bool | bConsoleMode | |||
) | [inline, static] |
float orxonox::Game::getAvgFPS | ( | ) | [inline] |
Referenced by orxonox::GSDedicated::printLine(), and orxonox::DebugFPSText::tick().
float orxonox::Game::getAvgTickTime | ( | ) | [inline] |
Referenced by orxonox::GSDedicated::printLine(), and orxonox::DebugRTRText::tick().
const Clock& orxonox::Game::getGameClock | ( | ) | [inline] |
static Game& orxonox::Game::getInstance | ( | ) | [inline, static] |
Referenced by orxonox::GSRoot::activate(), orxonox::GSClient::activate(), orxonox::GSIOConsole::loadMenu(), orxonox::GSDedicated::printLine(), orxonox::GSMainMenu::startClient(), orxonox::GSMainMenu::startDedicated(), orxonox::GSMainMenu::startServer(), orxonox::GSMainMenu::startStandalone(), orxonox::stop_game(), orxonox::DebugRTRText::tick(), orxonox::DebugFPSText::tick(), orxonox::GSRoot::update(), orxonox::GSGraphics::update(), and orxonox::OgreWindowEventListener::windowClosed().
GameState * orxonox::Game::getState | ( | const std::string & | name | ) |
References COUT, gameStates_, and orxonox::getLowercase().
Referenced by Game(), requestState(), and setStateHierarchy().
void orxonox::Game::loadState | ( | GameState * | state | ) | [private] |
References orxonox::GameState::activate(), activeStates_, orxonox::GameState::activity_, and bChangingState_.
Referenced by run().
void orxonox::Game::popState | ( | ) |
void orxonox::Game::requestState | ( | const std::string & | name | ) |
References activeStateNode_, COUT, getState(), and requestedStateNodes_.
Referenced by orxonox::GSRoot::activate(), popState(), requestStates(), run(), orxonox::GSRoot::update(), and orxonox::GSGraphics::update().
void orxonox::Game::requestStates | ( | const std::string & | names | ) |
void orxonox::Game::run | ( | ) |
Main loop of the orxonox game.
References activeStateNode_, activeStates_, addTickTime(), avgFPS_, avgTickTime_, bAbort_, orxonox::Clock::capture(), configuration_, core_, COUT, orxonox::GameConfiguration::fpsLimit_, gameClock_, orxonox::Clock::getDeltaTimeMicroseconds(), orxonox::Clock::getRealMicroseconds(), loadState(), periodTickTime_, periodTime_, requestedStateNodes_, requestState(), rootStateNode_, orxonox::GameConfiguration::statisticsAvgLength_, orxonox::GameConfiguration::statisticsRefreshCycle_, statisticsTickTimes_, stop(), unloadState(), orxonox::Core::update(), and orxonox::usleep().
void orxonox::Game::setStateHierarchy | ( | const std::string & | str | ) |
References orxonox::GameState::children_, getState(), orxonox::GameState::parent_, rootStateNode_, and ThrowException.
void orxonox::Game::stop | ( | ) |
References bAbort_.
Referenced by run(), orxonox::stop_game(), and orxonox::OgreWindowEventListener::windowClosed().
void orxonox::Game::unloadState | ( | orxonox::GameState * | state | ) | [private] |
References activeStates_, orxonox::GameState::activity_, bChangingState_, COUT, orxonox::GameState::deactivate(), and orxonox::GameState::getName().
Referenced by run().
boost::shared_ptr<GameStateTreeNode> orxonox::Game::activeStateNode_ [private] |
Referenced by Game(), popState(), requestState(), and run().
std::vector<GameState*> orxonox::Game::activeStates_ [private] |
Referenced by Game(), loadState(), run(), and unloadState().
float orxonox::Game::avgFPS_ [private] |
float orxonox::Game::avgTickTime_ [private] |
bool orxonox::Game::bAbort_ [private] |
bool orxonox::Game::bChangingState_ [private] |
Referenced by Game(), loadState(), and unloadState().
GameConfiguration* orxonox::Game::configuration_ [private] |
Core* orxonox::Game::core_ [private] |
Clock* orxonox::Game::gameClock_ [private] |
std::map< std::string, Game::GameStateInfo > orxonox::Game::gameStateDeclarations_s [static, private] |
Referenced by declareGameState(), and Game().
std::map<std::string, GameState*> orxonox::Game::gameStates_ [private] |
Referenced by Game(), getState(), and ~Game().
uint32_t orxonox::Game::periodTickTime_ [private] |
Referenced by addTickTime(), Game(), and run().
uint32_t orxonox::Game::periodTime_ [private] |
std::vector<boost::shared_ptr<GameStateTreeNode> > orxonox::Game::requestedStateNodes_ [private] |
Referenced by popState(), requestState(), and run().
boost::shared_ptr<GameStateTreeNode> orxonox::Game::rootStateNode_ [private] |
Referenced by Game(), popState(), run(), and setStateHierarchy().
Game * orxonox::Game::singletonRef_s = 0 [static, private] |
uint64_t orxonox::Game::statisticsStartTime_ [private] |
Referenced by Game().
std::list<StatisticsTickInfo> orxonox::Game::statisticsTickTimes_ [private] |
Referenced by addTickTime(), Game(), and run().