MainLoop Class Reference

Runs the main loop. More...

#include <MainLoop.h>

List of all members.

Public Member Functions

 MainLoop ()
virtual ~MainLoop ()
void pop_scene ()
 Stop the current scene.
void push_scene (Engine::Scene &scene)
 Run a scene.

Private Member Functions

void run (Engine::Scene &scene)
 Run the current scene until it quits.
void process_events ()
 Record input.
void do_logic (Engine::Scene &scene)
 Update game state (do logic / physics).
void redraw (Engine::Scene &scene)
 Update the display.
void update_sound (Engine::Scene &scene)
 Update the sound.

Private Attributes

unsigned int milliseconds
bool done
 true iff current scene should end.
bool quit
 true iff all scenes should end.

Detailed Description

Runs the main loop.

Scene can take over for a while with push_scene(). Once they are done, they should call pop_scene(). Scenes are recursive, pop_scene() will return to the caller of push_scene(), which is often another scene.

Definition at line 22 of file MainLoop.h.

Constructor & Destructor Documentation

MainLoop::MainLoop (  ) 

Definition at line 20 of file MainLoop.cpp.

MainLoop::~MainLoop (  )  [virtual]

Definition at line 26 of file MainLoop.cpp.

Member Function Documentation

void MainLoop::do_logic ( Engine::Scene scene  )  [private]

Update game state (do logic / physics).

Definition at line 88 of file MainLoop.cpp.

void MainLoop::pop_scene (  ) 

Stop the current scene.

When there are no more scenes, the main loop ends. Must be called only once per scene.

Definition at line 43 of file MainLoop.cpp.

void MainLoop::process_events (  )  [private]

Record input.

Definition at line 57 of file MainLoop.cpp.

void MainLoop::push_scene ( Engine::Scene scene  ) 

Run a scene.

The scene should call pop_scene() when it wants to quit. push_scene() does not return until this happens.

Definition at line 48 of file MainLoop.cpp.

void MainLoop::redraw ( Engine::Scene scene  )  [private]

Update the display.

Definition at line 102 of file MainLoop.cpp.

void MainLoop::run ( Engine::Scene scene  )  [private]

Run the current scene until it quits.

Definition at line 30 of file MainLoop.cpp.

void MainLoop::update_sound ( Engine::Scene scene  )  [private]

Update the sound.

Definition at line 108 of file MainLoop.cpp.

Member Data Documentation

bool MainLoop::done [private]

true iff current scene should end.

Definition at line 53 of file MainLoop.h.

unsigned int MainLoop::milliseconds [private]

Definition at line 51 of file MainLoop.h.

bool MainLoop::quit [private]

true iff all scenes should end.

Definition at line 55 of file MainLoop.h.

The documentation for this class was generated from the following files:
Get Racer at Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:16 2010 by Doxygen version 1.4.7 for Racer version svn335.