GameEngine::GameState Class Reference

#include <GameState.h>

Inheritance diagram for GameEngine::GameState:

Inheritance graph
[legend]
Collaboration diagram for GameEngine::GameState:

Collaboration graph
[legend]
List of all members.

Detailed Description

A game state represent a distinct

Definition at line 39 of file GameState.h.

Public Member Functions

 GameState (GameApp *const application, BaseGame *const game, const Vector3 &gravity)
virtual ~GameState ()
virtual void init ()
virtual void start ()
virtual void stop ()
virtual void pause ()
virtual void resume ()
void changeState (GameState *state) const
virtual bool handleEvent (const Event &event)
virtual void onUpdate (const double &dt)
virtual bool keyPressed (const OIS::KeyEvent &arg)
virtual bool keyReleased (const OIS::KeyEvent &arg)
virtual bool mouseMoved (const OIS::MouseEvent &arg)
virtual bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButtonID id)
virtual bool mouseReleased (const OIS::MouseEvent &arg, OIS::MouseButtonID id)
virtual void addObject (boost::shared_ptr< GameObject > ptr)
virtual void removeObject (boost::shared_ptr< GameObject > ptr)
BaseGame *const getGame () const
PhysicsManagergetPhysicsManager ()

Protected Attributes

GameAppmApplication
BaseGamemGame
ProcessManagermProcessManager
Ogre::SceneManager * mSceneManager
Ogre::SceneNode * mRootSceneNode
PhysicsManagermPhysicsMan
bool mInitialised
bool mActive
std::string mName


Constructor & Destructor Documentation

GameEngine::GameState::GameState ( GameApp *const  application,
BaseGame *const  game,
const Vector3 gravity 
)

Constructor

Parameters:
application Pointer back to the main application
game The game that this state belongs too
gravity A vector representing the gravity of the world, used when creating the physics manager

Definition at line 26 of file GameState.cpp.

GameEngine::GameState::~GameState (  )  [virtual]

Destructor

Definition at line 33 of file GameState.cpp.


Member Function Documentation

virtual void GameEngine::GameState::init ( void   )  [inline, virtual]

Initialise the state

Definition at line 57 of file GameState.h.

virtual void GameEngine::GameState::start (  )  [inline, virtual]

Start the state

Definition at line 63 of file GameState.h.

virtual void GameEngine::GameState::stop (  )  [inline, virtual]

Stop the state

Definition at line 67 of file GameState.h.

virtual void GameEngine::GameState::pause (  )  [inline, virtual]

Pause the state temporarily

Definition at line 73 of file GameState.h.

virtual void GameEngine::GameState::resume (  )  [inline, virtual]

Resume the state after it has been paused

Definition at line 77 of file GameState.h.

void GameEngine::GameState::changeState ( GameState state  )  const

Change to a different state

Parameters:
state The state to change to

Definition at line 47 of file GameState.cpp.

virtual bool GameEngine::GameState::handleEvent ( const Event event  )  [inline, virtual]

Handle events

Parameters:
event The event to handle
Returns:
true if the event was consumed, false otherwise

Implements GameEngine::IEventListener.

Definition at line 94 of file GameState.h.

virtual void GameEngine::GameState::onUpdate ( const double &  dt  )  [inline, virtual]

Update the state

Parameters:
dt Time since last frame rendered

Definition at line 100 of file GameState.h.

virtual bool GameEngine::GameState::keyPressed ( const OIS::KeyEvent &  arg  )  [inline, virtual]

Handle a key pressed event

Parameters:
arg The key event
Returns:
true if the event is consumed, false otherwise

Definition at line 111 of file GameState.h.

virtual bool GameEngine::GameState::keyReleased ( const OIS::KeyEvent &  arg  )  [inline, virtual]

Handle a key released event

Parameters:
arg The key event
Returns:
true if the event is consumed, false otherwise

Definition at line 118 of file GameState.h.

virtual bool GameEngine::GameState::mouseMoved ( const OIS::MouseEvent &  arg  )  [inline, virtual]

Handle a mouse moved event

Parameters:
arg The mouse event
Returns:
true if the event is consumed, false otherwise

Definition at line 125 of file GameState.h.

virtual bool GameEngine::GameState::mousePressed ( const OIS::MouseEvent &  arg,
OIS::MouseButtonID  id 
) [inline, virtual]

Handle a mouse button pressed event

Parameters:
arg The mouse event
id The id of the button pressed
Returns:
true if the event is consumed, false otherwise

Definition at line 133 of file GameState.h.

virtual bool GameEngine::GameState::mouseReleased ( const OIS::MouseEvent &  arg,
OIS::MouseButtonID  id 
) [inline, virtual]

Handle a mouse button released event

Parameters:
arg The mouse event
id The id of the button released
Returns:
true if the event is consumed, false otherwise

Definition at line 141 of file GameState.h.

void GameEngine::GameState::addObject ( boost::shared_ptr< GameObject ptr  )  [virtual]

Add an object to the state

Parameters:
ptr The object to add

Definition at line 52 of file GameState.cpp.

void GameEngine::GameState::removeObject ( boost::shared_ptr< GameObject ptr  )  [virtual]

Remove and object from the state

Parameters:
ptr The object to remove

Definition at line 63 of file GameState.cpp.

BaseGame* const GameEngine::GameState::getGame (  )  const [inline]

Get the game this state is part of

Returns:
the game

Definition at line 164 of file GameState.h.

PhysicsManager* GameEngine::GameState::getPhysicsManager (  )  [inline]

Get the physics manager

Returns:
the physics manager

Definition at line 170 of file GameState.h.


Member Data Documentation

GameApp* GameEngine::GameState::mApplication [protected]

Definition at line 173 of file GameState.h.

BaseGame* GameEngine::GameState::mGame [protected]

Definition at line 174 of file GameState.h.

ProcessManager* GameEngine::GameState::mProcessManager [protected]

Definition at line 176 of file GameState.h.

Ogre::SceneManager* GameEngine::GameState::mSceneManager [protected]

Definition at line 177 of file GameState.h.

Ogre::SceneNode* GameEngine::GameState::mRootSceneNode [protected]

Definition at line 178 of file GameState.h.

PhysicsManager* GameEngine::GameState::mPhysicsMan [protected]

Definition at line 179 of file GameState.h.

bool GameEngine::GameState::mInitialised [protected]

Definition at line 181 of file GameState.h.

bool GameEngine::GameState::mActive [protected]

Definition at line 182 of file GameState.h.

std::string GameEngine::GameState::mName [protected]

Definition at line 184 of file GameState.h.


The documentation for this class was generated from the following files:
Generated on Thu Apr 19 09:48:48 2007 for GameEngine by  doxygen 1.5.2