Engine::GameScene Class Reference

#include <GameScene.h>

Inheritance diagram for Engine::GameScene:

Engine::Scene List of all members.

Public Member Functions

 GameScene (std::vector< std::pair< InputHandler::iterator, unsigned int > > input_devices, const Track::Track &track)
 Create a game where the players use specified input devices.
virtual ~GameScene ()
virtual void take_input (InputReport &report)
 Take input from an input device.
virtual void update_logic (unsigned int milliseconds_elapsed)
 Process any status changes that occur due to elapsed time.
virtual void draw ()
 Draw the scene using OpenGL commands.
virtual void do_sound ()
 Update the audio.
Physics::Worldget_world ()
 Get the physics world used for the scene.
void set_save_replay (bool value=true)
 Turn on or off replay saving.

Private Member Functions

void draw_paused_screen ()
 Draw the overlay that appears when the game is paused.
void draw_for_player (unsigned int player, float aspect)
 Draw the window for the specified player.
void draw_world (unsigned int player, float aspect)
void draw_hud (unsigned int player)
void draw_speedometer (unsigned int player)
void draw_lap_info (unsigned int player)
void draw_rank (unsigned int player)
void draw_disqualified (unsigned int player)
 Write 'Disqualified' in the middle of a player's viewport.
void draw_finished (unsigned int player)
 Write 'Finished' in the middle of a player's viewport.
void draw_reverse_sign (unsigned int player)
 Show the user they are facing the wrong way.
void draw_countdown ()
 Show the countdown at the begining of the race.
void rank_cars ()
 Set car_ranks.
void unpause ()
 Unpause the game and reset the pause menu.

Private Attributes

std::vector< std::pair< InputHandler::iterator,
unsigned int > > 
m_input_devices
 Input devices used for cars, in the same order as cars.
std::stringstream m_replay_header
Graphics::SkyBox sky
Graphics::SkyParticles m_sky_particles
Track::OcclusionTester occlusion_tester
std::vector< GameObjects::Car * > cars
std::vector< unsigned int > m_humans
 Indices of the human players in cars and m_input_devices.
std::vector< bool > car_skip
 For each human player, true if they tried to skip the pause before quitting.
std::vector< CarCamera * > car_cameras
 Cameras for each human player's car.
btRigidBody * track_body
btRigidBody * floor_body
boost::shared_ptr< btCollisionShape > track_shape
boost::shared_ptr< btCollisionShape > floor_shape
const Track::Tracktrack
 The course to play on.
Physics::World world
bool save_replay
 Save replays when the scene is destroyed?
float fps
 frequency of rendering in hertz.
std::vector< int > car_ranks
 The ranking of the cars.
btVector3 start_point
 The centre of the starting plane.
btVector3 start_plane_normal
 A normalized vector in the direction perpendicular to the starting plane.
btScalar start_plane_distance
 The signed distance between the origin and and the starting plane.
Track::Texturem_speedometer_texture
 The texture with the speedometer parts.
Track::Texturem_best_lap_texture
 The texture with the best lap icon.
Track::Texturem_finish_border_texture
 The texture for the border above and below the finish message.
Track::Texturem_finish_text_texture
 The texture that says "Finished".
Track::Texturem_disqualified_text_texture
 The texture that says "Disqualified".
Track::Texturem_reverse_texture
 The texture for the u-turn sign that appears when facing the wrong way.
Track::Texturem_countdown_texture
 The texture for the countdown at the start of the race.
int countdown_timer
 Millisecond timer to the start of the race.
bool paused
 True if the game is paused.
UI::PauseMenu m_pause_menu
 The menu to display when paused.
bool show_debug
unsigned int m_debug_list_name
 Display list for debug draw of the track.
unsigned int m_debug_texture_name
 Texture name for the navigation texture used for debug draw.
Track::DrawableMesh ai_mesh
unsigned int m_total_frames
 number of frames processed since the start of the game.
unsigned int m_total_time
 number of milliseconds elapsed since the start of the game.

Detailed Description

Definition at line 32 of file GameScene.h.


Constructor & Destructor Documentation

Engine::GameScene::GameScene ( std::vector< std::pair< InputHandler::iterator, unsigned int > >  input_devices,
const Track::Track track 
)

Create a game where the players use specified input devices.

Parameters:
input_devices InputHandler iterators to the input devices, paired with the car model to use for each player.
track The track to play on.

Todo:
Replays should save the version since they are not compatible with other versions. Any minor tweak in game mechanics, car paramaters, or courses will break the replay. We don't actually want compatibility, a replay from an old version does not reflect what is possible in a current version, so it is meaningless.

Todo:
Don't make cameras for AI cars.

Todo:
In a replay, give one view of a car, and allow switching the car that is visible.

Definition at line 42 of file GameScene.cpp.

Engine::GameScene::~GameScene (  )  [virtual]

Definition at line 216 of file GameScene.cpp.


Member Function Documentation

void Engine::GameScene::do_sound (  )  [virtual]

Update the audio.

Implements Engine::Scene.

Definition at line 1012 of file GameScene.cpp.

void Engine::GameScene::draw (  )  [virtual]

Draw the scene using OpenGL commands.

Must go from any state to ready for a buffer swap.

Todo:
only recalculate this when the screen size changes or on the first run.

Todo:
'player' is only going to work if the human players (with cameras and viewports) are before all the computer players in the car list. Otherwise the HUD will refer to the wrong car.

Implements Engine::Scene.

Definition at line 388 of file GameScene.cpp.

void Engine::GameScene::draw_countdown (  )  [private]

Show the countdown at the begining of the race.

Definition at line 969 of file GameScene.cpp.

void Engine::GameScene::draw_disqualified ( unsigned int  player  )  [private]

Write 'Disqualified' in the middle of a player's viewport.

Definition at line 865 of file GameScene.cpp.

void Engine::GameScene::draw_finished ( unsigned int  player  )  [private]

Write 'Finished' in the middle of a player's viewport.

Definition at line 888 of file GameScene.cpp.

void Engine::GameScene::draw_for_player ( unsigned int  player,
float  aspect 
) [private]

Draw the window for the specified player.

Viewport must be set up first.

Parameters:
player the index in the car_cameras array to use.
aspect The aspect ratio (width divided by height) of the viewport.

Definition at line 591 of file GameScene.cpp.

void Engine::GameScene::draw_hud ( unsigned int  player  )  [private]

Definition at line 665 of file GameScene.cpp.

void Engine::GameScene::draw_lap_info ( unsigned int  player  )  [private]

Definition at line 759 of file GameScene.cpp.

void Engine::GameScene::draw_paused_screen (  )  [private]

Draw the overlay that appears when the game is paused.

Definition at line 558 of file GameScene.cpp.

void Engine::GameScene::draw_rank ( unsigned int  player  )  [private]

Definition at line 833 of file GameScene.cpp.

void Engine::GameScene::draw_reverse_sign ( unsigned int  player  )  [private]

Show the user they are facing the wrong way.

Definition at line 958 of file GameScene.cpp.

void Engine::GameScene::draw_speedometer ( unsigned int  player  )  [private]

Definition at line 707 of file GameScene.cpp.

void Engine::GameScene::draw_world ( unsigned int  player,
float  aspect 
) [private]

Definition at line 617 of file GameScene.cpp.

Physics::World & Engine::GameScene::get_world (  ) 

Get the physics world used for the scene.

Definition at line 1019 of file GameScene.cpp.

void Engine::GameScene::rank_cars (  )  [private]

Set car_ranks.

Definition at line 1029 of file GameScene.cpp.

void Engine::GameScene::set_save_replay ( bool  value = true  ) 

Turn on or off replay saving.

Replay saving is turned on by default. When the scene is destroyed, the replay can be saved to a file called last replay.

Parameters:
value true to save replays, false otherwise.

Definition at line 1024 of file GameScene.cpp.

void Engine::GameScene::take_input ( InputReport report  )  [virtual]

Take input from an input device.

Parameters:
report An input report, which may be freed immediately after the call returns.

Todo:
Give some sort of warning for low batteries. We need direct wii remote support first.

Implements Engine::Scene.

Definition at line 260 of file GameScene.cpp.

void Engine::GameScene::unpause (  )  [private]

Unpause the game and reset the pause menu.

Definition at line 1066 of file GameScene.cpp.

void Engine::GameScene::update_logic ( unsigned int  milliseconds_elapsed  )  [virtual]

Process any status changes that occur due to elapsed time.

Parameters:
milliseconds_elapsed time in milliseconds since last update_logic.

Implements Engine::Scene.

Definition at line 318 of file GameScene.cpp.


Member Data Documentation

Track::DrawableMesh Engine::GameScene::ai_mesh [private]

Definition at line 177 of file GameScene.h.

std::vector<CarCamera *> Engine::GameScene::car_cameras [private]

Cameras for each human player's car.

Definition at line 88 of file GameScene.h.

std::vector<int> Engine::GameScene::car_ranks [private]

The ranking of the cars.

car_ranks[i] is the rank of the ith car. Rank 0 is first.

Definition at line 109 of file GameScene.h.

std::vector<bool> Engine::GameScene::car_skip [private]

For each human player, true if they tried to skip the pause before quitting.

Definition at line 86 of file GameScene.h.

std::vector<GameObjects::Car *> Engine::GameScene::cars [private]

Definition at line 82 of file GameScene.h.

int Engine::GameScene::countdown_timer [private]

Millisecond timer to the start of the race.

>= 0 implies race has started.

Definition at line 161 of file GameScene.h.

btRigidBody* Engine::GameScene::floor_body [private]

Definition at line 90 of file GameScene.h.

boost::shared_ptr<btCollisionShape> Engine::GameScene::floor_shape [private]

Definition at line 92 of file GameScene.h.

float Engine::GameScene::fps [private]

frequency of rendering in hertz.

Calcualted from time between last two frames.

Definition at line 104 of file GameScene.h.

Track::Texture* Engine::GameScene::m_best_lap_texture [private]

The texture with the best lap icon.

Definition at line 146 of file GameScene.h.

Track::Texture* Engine::GameScene::m_countdown_texture [private]

The texture for the countdown at the start of the race.

Definition at line 156 of file GameScene.h.

unsigned int Engine::GameScene::m_debug_list_name [private]

Display list for debug draw of the track.

Definition at line 174 of file GameScene.h.

unsigned int Engine::GameScene::m_debug_texture_name [private]

Texture name for the navigation texture used for debug draw.

Definition at line 176 of file GameScene.h.

Track::Texture* Engine::GameScene::m_disqualified_text_texture [private]

The texture that says "Disqualified".

Definition at line 152 of file GameScene.h.

Track::Texture* Engine::GameScene::m_finish_border_texture [private]

The texture for the border above and below the finish message.

Definition at line 148 of file GameScene.h.

Track::Texture* Engine::GameScene::m_finish_text_texture [private]

The texture that says "Finished".

Definition at line 150 of file GameScene.h.

std::vector<unsigned int> Engine::GameScene::m_humans [private]

Indices of the human players in cars and m_input_devices.

Definition at line 84 of file GameScene.h.

std::vector<std::pair<InputHandler::iterator, unsigned int> > Engine::GameScene::m_input_devices [private]

Input devices used for cars, in the same order as cars.

Definition at line 77 of file GameScene.h.

UI::PauseMenu Engine::GameScene::m_pause_menu [private]

The menu to display when paused.

Definition at line 166 of file GameScene.h.

std::stringstream Engine::GameScene::m_replay_header [private]

Definition at line 78 of file GameScene.h.

Track::Texture* Engine::GameScene::m_reverse_texture [private]

The texture for the u-turn sign that appears when facing the wrong way.

Definition at line 154 of file GameScene.h.

Graphics::SkyParticles Engine::GameScene::m_sky_particles [private]

Definition at line 80 of file GameScene.h.

Track::Texture* Engine::GameScene::m_speedometer_texture [private]

The texture with the speedometer parts.

Definition at line 144 of file GameScene.h.

unsigned int Engine::GameScene::m_total_frames [private]

number of frames processed since the start of the game.

Definition at line 180 of file GameScene.h.

unsigned int Engine::GameScene::m_total_time [private]

number of milliseconds elapsed since the start of the game.

Definition at line 182 of file GameScene.h.

Track::OcclusionTester Engine::GameScene::occlusion_tester [private]

Definition at line 81 of file GameScene.h.

bool Engine::GameScene::paused [private]

True if the game is paused.

Definition at line 164 of file GameScene.h.

bool Engine::GameScene::save_replay [private]

Save replays when the scene is destroyed?

Definition at line 100 of file GameScene.h.

bool Engine::GameScene::show_debug [private]

Definition at line 170 of file GameScene.h.

Graphics::SkyBox Engine::GameScene::sky [private]

Definition at line 79 of file GameScene.h.

btScalar Engine::GameScene::start_plane_distance [private]

The signed distance between the origin and and the starting plane.

Definition at line 141 of file GameScene.h.

btVector3 Engine::GameScene::start_plane_normal [private]

A normalized vector in the direction perpendicular to the starting plane.

Definition at line 139 of file GameScene.h.

btVector3 Engine::GameScene::start_point [private]

The centre of the starting plane.

Definition at line 137 of file GameScene.h.

const Track::Track& Engine::GameScene::track [private]

The course to play on.

Definition at line 95 of file GameScene.h.

btRigidBody* Engine::GameScene::track_body [private]

Definition at line 89 of file GameScene.h.

boost::shared_ptr<btCollisionShape> Engine::GameScene::track_shape [private]

Definition at line 91 of file GameScene.h.

Physics::World Engine::GameScene::world [private]

Definition at line 97 of file GameScene.h.


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

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