GluonEngine::Game Class Reference

#include <game.h>

Inheritance diagram for GluonEngine::Game:
GluonCore::Singleton< T > QObject

List of all members.

Public Slots

void setGameProject (GluonEngine::GameProject *newGameProject)
void setCurrentScene (Scene *newCurrentScene)
void setCurrentScene (const QString &sceneName)
void resetCurrentScene ()
void runGame ()
void runGameFixedUpdate (int updatesPerSecond=25, int maxFrameSkip=5)
void runGameFixedTimestep (int framesPerSecond=25)
void stopGame ()
void setPause (bool pause)
void initializeAll ()
void startAll ()
void drawAll (int time=1)
void updateAll (int time=10)
void stopAll ()
void cleanupAll ()

Signals

void showDebug (const QString &debugText)
void currentSceneChanged (GluonEngine::Scene *)
void currentProjectChanged (GluonEngine::GameProject *)
void updated (int)
void painted (int)

Public Member Functions

int getCurrentTick ()
ScenecurrentScene () const
GluonEngine::GameProjectgameProject () const
Q_INVOKABLE bool isRunning () const
Q_INVOKABLE bool isPaused () const
Q_INVOKABLE
GluonEngine::GameObject
getFromScene (const QString &name)
Q_INVOKABLE
GluonEngine::GameObject
clone (GluonEngine::GameObject *obj)
Q_INVOKABLE float random ()

Properties

Scene currentScene
GluonEngine::GameProject gameProject

Friends

class GluonCore::Singleton< Game >

Detailed Description

Definition at line 57 of file game.h.


Member Function Documentation

void Game::cleanupAll (  )  [slot]

Cleanup all objects in the current scene.

Definition at line 228 of file game.cpp.

GameObject * Game::clone ( GluonEngine::GameObject obj  ) 

Definition at line 363 of file game.cpp.

void GluonEngine::Game::currentProjectChanged ( GluonEngine::GameProject  )  [signal]
Scene* GluonEngine::Game::currentScene (  )  const
void GluonEngine::Game::currentSceneChanged ( GluonEngine::Scene  )  [signal]
void Game::drawAll ( int  time = 1  )  [slot]

Draw all items in the current scene.

Definition at line 211 of file game.cpp.

GluonEngine::GameProject* GluonEngine::Game::gameProject (  )  const
int Game::getCurrentTick (  ) 

Definition at line 56 of file game.cpp.

GameObject * Game::getFromScene ( const QString &  name  ) 

Retrieve an object from the current scene.

Parameters:
name The name of the object

Definition at line 358 of file game.cpp.

void Game::initializeAll (  )  [slot]

Initialize all objects in the current scene.

Definition at line 201 of file game.cpp.

bool Game::isPaused (  )  const

Definition at line 253 of file game.cpp.

bool Game::isRunning (  )  const

Definition at line 248 of file game.cpp.

void GluonEngine::Game::painted ( int   )  [signal]
float Game::random (  ) 

Generate a random number between 0 and 1.

Implemented here as a workaround for a Qt bug.

Returns:
The random number generated.

Definition at line 233 of file game.cpp.

void Game::resetCurrentScene (  )  [slot]

Resets the current scene to its initial conditions

Definition at line 297 of file game.cpp.

void GluonEngine::Game::runGame (  )  [inline, slot]

Definition at line 111 of file game.h.

void Game::runGameFixedTimestep ( int  framesPerSecond = 25  )  [slot]

Run the game using a fixed time between each update

Parameters:
int framesPerSecond The number of frames per second that the game will attempt to keep up with

Definition at line 125 of file game.cpp.

void Game::runGameFixedUpdate ( int  updatesPerSecond = 25,
int  maxFrameSkip = 5 
) [slot]

Run the game at full framerate (with an optional maximum number of skipped frames), but with a fixed game update rate, defaulting to 25 updates per second

Parameters:
int updatesPerSecond The number of updates per second
Parameters:
int maxFrameSkip The maximum number of frames that you're allowed to skip before forcing a redraw

Definition at line 62 of file game.cpp.

void Game::setCurrentScene ( const QString &  sceneName  )  [slot]

Definition at line 290 of file game.cpp.

void Game::setCurrentScene ( Scene newCurrentScene  )  [slot]

Definition at line 259 of file game.cpp.

void Game::setGameProject ( GluonEngine::GameProject newGameProject  )  [slot]

Definition at line 318 of file game.cpp.

void Game::setPause ( bool  pause  )  [slot]

Definition at line 186 of file game.cpp.

void GluonEngine::Game::showDebug ( const QString &  debugText  )  [signal]
void Game::startAll (  )  [slot]

Start all objects in the current scene.

Definition at line 206 of file game.cpp.

void Game::stopAll (  )  [slot]

Stop all objects in the current scene.

Definition at line 223 of file game.cpp.

void Game::stopGame (  )  [slot]

Definition at line 178 of file game.cpp.

void Game::updateAll ( int  time = 10  )  [slot]

Update all items in the current scene.

Definition at line 217 of file game.cpp.

void GluonEngine::Game::updated ( int   )  [signal]

Friends And Related Function Documentation

friend class GluonCore::Singleton< Game > [friend]

Definition at line 166 of file game.h.


Property Documentation

Scene * Game::currentScene [read, write]

The Scene which is currently being handled by the game loop

Definition at line 63 of file game.h.

GluonEngine::GameProject * Game::gameProject [read, write]

The GameProject containing the game which is currently being played

Definition at line 67 of file game.h.


The documentation for this class was generated from the following files:
Generated on Mon Dec 27 13:13:43 2010 for Gluon by  doxygen 1.6.3