syBR::Game::Game Class Reference

Game class declaration. More...

#include <Game.hpp>

List of all members.

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::Loggerm_pLogger
 Pointer to the logger to be used.
Renderer::RenderSystemm_pRenderSystem
 Render system.
Ogre::Timer * m_pInterFrameTimer
 Inter-frame timer.
std::pair< const
PluginDescriptor *,
InputPlugin * > 
m_input
 Input system.
InputCore::ActionManagerm_pActionManager
 Instance of the action manager.
GUIManagerm_pGUIManager
 Instance of the GUI manager.
ScriptManagerm_pScriptManager
 Instance of the script manager.
SceneManagerm_pSceneManager
 Instance of the scene manager.
std::vector
< std::string > 
m_vUpdateFunctions
 List of update functions names to be called.


Detailed Description

Game class declaration.

It allows to initialize a game and effectively run it.


Constructor & Destructor Documentation

syBR::Game::Game::Game ( Core::Logger pLogger  ) 

Constructor.

Parameters:
pLogger Pointer to the instance of the logger to use

syBR::Game::Game::~Game (  ) 

Destructor.


Member Function Documentation

bool syBR::Game::Game::run (  ) 

Start the game and return when the game has been terminated.

Returns:
One of these:
  • true if the game has been successfully started
  • false otherwise

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.

Returns:
Time elapsed since last frame in milliseconds

bool syBR::Game::Game::registerUpdateScript ( const std::string &  name  ) 

Register the name of a script function to be called to update the game state.

Parameters:
name Name of the update function
Returns:
One of these:
  • true in case of success
  • false otherwise

bool syBR::Game::Game::unregisterUpdateScript ( const std::string &  name  ) 

Unregister the name of a previously registered script function.

Parameters:
name Name of the update function
Returns:
One of these:
  • true in case of success
  • false otherwise

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.

Returns:
One of these:
  • true in case of success
  • false otherwise

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.

Returns:
One of these:
  • true if plugins were successfully loaded
  • false otherwise
Todo:
Audio and network plugins

void syBR::Game::Game::unloadPlugins (  )  [private]

Unload plugins.

The plugins to be unloaded are the following:

Todo:
Audio and network plugins

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.

Todo:
: put this in the ScriptManager
Todo:
: pre-compile function calls (?)


Member Data Documentation

Core::Logger* syBR::Game::Game::m_pLogger [private]

Pointer to the logger to be used.

Renderer::RenderSystem* syBR::Game::Game::m_pRenderSystem [private]

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.

InputCore::ActionManager* syBR::Game::Game::m_pActionManager [private]

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.


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

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