#include <Game.hpp>
Public Member Functions | |
| Game (Core::Logger *pLogger) | |
| Constructor. | |
| ~Game () | |
| Destructor. | |
| bool | run () |
| Start the game and return when the game has been terminated. | |
| const unsigned long | getTimeSinceLastFrame () const |
| Get elapsed time since last frame in milliseconds. | |
| bool | registerUpdateScript (const std::string &name) |
| Register the name of a script function to be called to update the game state. | |
| bool | unregisterUpdateScript (const std::string &name) |
| Unregister the name of a previously registered script function. | |
Private Member Functions | |
| bool | initialize () |
| Initialize game system. | |
| void | terminate () |
| Terminate game system. | |
| bool | loadPlugins () |
| Load plugins. | |
| void | unloadPlugins () |
| Unload plugins. | |
| void | executeUpdateScripts () |
| Execute update scripts. | |
Private Attributes | |
| Core::Logger * | m_pLogger |
| Pointer to the logger to be used. | |
| Renderer::RenderSystem * | m_pRenderSystem |
| Render system. | |
| Ogre::Timer * | m_pInterFrameTimer |
| Inter-frame timer. | |
| std::pair< const PluginDescriptor *, InputPlugin * > | m_input |
| Input system. | |
| InputCore::ActionManager * | m_pActionManager |
| Instance of the action manager. | |
| GUIManager * | m_pGUIManager |
| Instance of the GUI manager. | |
| ScriptManager * | m_pScriptManager |
| Instance of the script manager. | |
| SceneManager * | m_pSceneManager |
| Instance of the scene manager. | |
| std::vector < std::string > | m_vUpdateFunctions |
| List of update functions names to be called. | |
It allows to initialize a game and effectively run it.
| syBR::Game::Game::Game | ( | Core::Logger * | pLogger | ) |
Constructor.
| pLogger | Pointer to the instance of the logger to use |
| syBR::Game::Game::~Game | ( | ) |
Destructor.
| bool syBR::Game::Game::run | ( | ) |
Start the game and return when the game has been terminated.
| const unsigned long syBR::Game::Game::getTimeSinceLastFrame | ( | ) | const |
Get elapsed time since last frame in milliseconds.
It actually reports the value of the m_pInterFrameTimer which means that, for this function to properly work, that timer must be reset at the end of each frame, before starting the next frame.
| bool syBR::Game::Game::registerUpdateScript | ( | const std::string & | name | ) |
Register the name of a script function to be called to update the game state.
| name | Name of the update function |
| bool syBR::Game::Game::unregisterUpdateScript | ( | const std::string & | name | ) |
Unregister the name of a previously registered script function.
| name | Name of the update function |
| bool syBR::Game::Game::initialize | ( | ) | [private] |
Initialize game system.
Create the render system and initialize the following elements:
It must be called after all plugins have been sucessfully loaded.
| void syBR::Game::Game::terminate | ( | ) | [private] |
Terminate game system.
Terminate everything that has been initialized by the initialize() function.
It must be called before all plugins have been sucessfully unloaded.
| bool syBR::Game::Game::loadPlugins | ( | ) | [private] |
Load plugins.
The plugins to be loaded are the following:
The plugins to be used are defined in a configuration file.
| void syBR::Game::Game::unloadPlugins | ( | ) | [private] |
Unload plugins.
The plugins to be unloaded are the following:
| void syBR::Game::Game::executeUpdateScripts | ( | ) | [private] |
Execute update scripts.
The update script functions registered through registerUpdateScript() will all be run, in the order they were registered.
Core::Logger* syBR::Game::Game::m_pLogger [private] |
Pointer to the logger to be used.
Render system.
Ogre::Timer* syBR::Game::Game::m_pInterFrameTimer [private] |
Inter-frame timer.
std::pair<const PluginDescriptor *, InputPlugin *> syBR::Game::Game::m_input [private] |
Input system.
Instance of the action manager.
GUIManager* syBR::Game::Game::m_pGUIManager [private] |
Instance of the GUI manager.
ScriptManager* syBR::Game::Game::m_pScriptManager [private] |
Instance of the script manager.
SceneManager* syBR::Game::Game::m_pSceneManager [private] |
Instance of the scene manager.
std::vector<std::string> syBR::Game::Game::m_vUpdateFunctions [private] |
List of update functions names to be called.
Copyright © 2008 by Sebastien Frippiat

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:33 2008