random_racer::MainApplication Class Reference

The class which sets up Random Racer's bare bones. More...

#include <MainApplication.h>

Inheritance diagram for random_racer::MainApplication:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 MainApplication ()
 Ctor, sets up the whole scene graph, connects callbacks, pretty important stuff.
virtual ~MainApplication ()
 Dtor, does noething special.
void quitCommand ()
 The command method which gets called when the application should quit can be called from the console.

Static Public Member Functions

static void updatePhysics (int args)
 This is the callback method of glutTimerFunc().
static void everyFrame (int args)
 Gets called with a glutTimer of 0 or so and so hopefully every frame.
static void cleanUpAtExit ()
 This gets registered at atexit(3), so we can stop threads, etc.
static void signalHandler (int sig)
 Handles SIGINT, etc so that we exit gracefully there.

Private Member Functions

void keyEvent ()
 Callback method for the key events.
void fovCommand (const std::string &newFov)
 A Command for changing the field of view of the camera, this gets registered at the console and gets usually called from there.
void carResetCommand ()
 SOMETIMES turns around the car, by resetting the rotation of the chassis and moving it a couple of units upwards.
void carPositionCommand ()
 Prints the current (absolute) position of the Car's chassis to the Console.
void camUpCommand (const std::string &newUpDouble)
 Modifies the y (up) difference of the cam from the car.
void camCorrectCommand (const std::string &newDouble)
 Modifies the amount upwards which gets calculates to the cars position.
void camBackCommand (const std::string &newBackDouble)
 Modifies the x (back) difference of the cam from the car.
void camStaticCommand (const std::string &newStaticBool)
 Sets static camera to true or false.
void camResetCommand ()
 Resets the camera to the default values if you played around too much.
void camFogCommand (const std::string &fogToggle)
 Toggles the Fog on and off.
void camDelayCommand (const std::string &newIntDelay)
 Changes the cam delay.
void versionCommand ()
 Outputs the current svn revision on the Console.
void fullscreenCommand ()
 Toggles between GLUTs fullscreen mode and the windowed mode.
void autoexecCommand ()
 Runs Console::autoexec() to load the autoexec.txt again.
void phyDebugCommand (const std::string &newDebugBool)
 enable physics debug nodes
void terDebugPlanesCommand (const std::string &which)
 toggles debugging of the reload planes
void terDebugPhyCommand (const std::string &newBool)
 toggles if the debug body of the bottom is shown or not.
void phyPerformanceAdjustCommand (const std::string &newBool)
 physics performance auto adjust
void phyStepTimeCommand (const std::string &newDouble)
 physics step time
void phyStepSizeCommand (const std::string &newBool)
 physics step size
void phyChangeTerrainCommand ()
 changes terrain, for debugging only.
void collectCoinsCommand (const std::string &newBool)
 Enables or disabled the collecting of points.
void preStartCommand (const std::string &temp)
 starts the presentation
void registerCommands ()
 Registers all commands which are more or less connectect to the members of this class at the Console.

Private Attributes

VRS::SO< VRS::GlutCanvas > m_canvas
VRS::SO< VRS::SceneThing > m_scene
VRS::SO< VRS::SceneThing > m_geometryRoot
VRS::SO< VRS::SceneThing > m_skyBoxThing
VRS::SO< VRS::LookAt > m_lookAt
VRS::SO< VRS::Perspective > m_perspective
VRS::SO< VRS::Fog > m_fog
VRS::SO< VRS::BehaviorCallback > m_keyCallBack
VRS::SO< Carm_car [2]
unsigned int m_activeCar
double m_oldFov
double m_targetFov
double m_lastFov
VRS::SO< ThirdPersonCameraHelperm_camHelper
VRS::SO< TerrainGeneratorm_odeGenerator
VRS::SO< TerrainGeneratorm_vrsGenerator
VRS::SO< VRSTerrainLoaderm_vrsLoader
VRS::SO< ODETerrainLoaderm_odeLoader
VRS::SO< LoaderGluem_odeGlue
VRS::SO< LoaderGluem_vrsGlue
VRS::SO< ReloadPlanem_planes [8]
VRS::SO< ControlPointGeneratorm_generator
VRS::SO< ItemDistributorm_itemDistributor
bool m_isFullscreen
VRS::SO< vrsode::TriangleDatam_triangleData
VRS::SO< ControlPointContainerm_container
VRS::SO< CenterScreenDisplaym_centerScreen
VRS::SO< Presenterm_presenter

Static Private Attributes

static const double c_defaultFov
static const unsigned int c_canvasWidth
static const unsigned int c_canvasHeight
static MainApplications_daMainApp
 We need this in cleanUpAtExit() to gracefully clean up things.

Detailed Description

The class which sets up Random Racer's bare bones.

Definition at line 46 of file MainApplication.h.


Constructor & Destructor Documentation

random_racer::MainApplication::MainApplication (  ) 

Ctor, sets up the whole scene graph, connects callbacks, pretty important stuff.

Definition at line 62 of file MainApplication.cpp.

References c_canvasHeight, c_canvasWidth, c_defaultFov, camResetCommand(), random_racer::ResourceManager::get(), random_racer::Console::get(), keyEvent(), m_activeCar, m_camHelper, m_canvas, m_car, m_centerScreen, m_container, m_fog, m_generator, m_geometryRoot, m_isFullscreen, m_itemDistributor, m_keyCallBack, m_lookAt, m_odeGlue, m_odeLoader, m_oldFov, m_perspective, m_planes, m_presenter, m_scene, m_vrsGlue, m_vrsLoader, registerCommands(), RR_VERSION, and s_daMainApp.

Here is the call graph for this function:

random_racer::MainApplication::~MainApplication (  )  [virtual]

Dtor, does noething special.

Definition at line 215 of file MainApplication.cpp.


Member Function Documentation

void random_racer::MainApplication::keyEvent (  )  [private]

Callback method for the key events.

Definition at line 220 of file MainApplication.cpp.

References random_utils::inRange(), m_activeCar, m_canvas, m_car, m_keyCallBack, m_lastFov, m_oldFov, m_perspective, and m_targetFov.

Referenced by MainApplication().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_racer::MainApplication::fovCommand ( const std::string &  newFov  )  [private]

A Command for changing the field of view of the camera, this gets registered at the console and gets usually called from there.

Definition at line 389 of file MainApplication.cpp.

References random_racer::Console::get(), random_utils::inRange(), and m_perspective.

Referenced by registerCommands().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_racer::MainApplication::carResetCommand (  )  [private]

SOMETIMES turns around the car, by resetting the rotation of the chassis and moving it a couple of units upwards.

Definition at line 422 of file MainApplication.cpp.

References m_activeCar, and m_car.

Referenced by registerCommands().

Here is the caller graph for this function:

void random_racer::MainApplication::carPositionCommand (  )  [private]

Prints the current (absolute) position of the Car's chassis to the Console.

Definition at line 435 of file MainApplication.cpp.

References random_racer::Console::get(), m_activeCar, and m_car.

Referenced by registerCommands().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_racer::MainApplication::camUpCommand ( const std::string &  newUpDouble  )  [private]

Modifies the y (up) difference of the cam from the car.

Definition at line 444 of file MainApplication.cpp.

References random_racer::Console::get(), and m_camHelper.

Referenced by registerCommands().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_racer::MainApplication::camCorrectCommand ( const std::string &  newDouble  )  [private]

Modifies the amount upwards which gets calculates to the cars position.

See ThirdPersonCameraHelper for defails.

Definition at line 514 of file MainApplication.cpp.

References random_racer::Console::get(), and m_camHelper.

Referenced by registerCommands().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_racer::MainApplication::camBackCommand ( const std::string &  newBackDouble  )  [private]

Modifies the x (back) difference of the cam from the car.

Definition at line 464 of file MainApplication.cpp.

References random_racer::Console::get(), and m_camHelper.

Referenced by registerCommands().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_racer::MainApplication::camStaticCommand ( const std::string &  newStaticBool  )  [private]

Sets static camera to true or false.

(ThirdPersonCameraHelper again)

Definition at line 497 of file MainApplication.cpp.

References random_racer::Console::get(), and m_camHelper.

Referenced by registerCommands().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_racer::MainApplication::camResetCommand (  )  [private]

Resets the camera to the default values if you played around too much.

Definition at line 487 of file MainApplication.cpp.

References c_defaultFov, m_camHelper, and m_perspective.

Referenced by MainApplication(), and registerCommands().

Here is the caller graph for this function:

void random_racer::MainApplication::camFogCommand ( const std::string &  fogToggle  )  [private]

Toggles the Fog on and off.

Definition at line 534 of file MainApplication.cpp.

References m_fog, and m_scene.

Referenced by registerCommands().

Here is the caller graph for this function:

void random_racer::MainApplication::camDelayCommand ( const std::string &  newIntDelay  )  [private]

Changes the cam delay.

Definition at line 685 of file MainApplication.cpp.

References random_racer::Console::get(), and m_camHelper.

Here is the call graph for this function:

void random_racer::MainApplication::versionCommand (  )  [private]

Outputs the current svn revision on the Console.

Definition at line 620 of file MainApplication.cpp.

References random_racer::Console::get(), and RR_VERSION.

Referenced by registerCommands().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_racer::MainApplication::fullscreenCommand (  )  [private]

Toggles between GLUTs fullscreen mode and the windowed mode.

Definition at line 650 of file MainApplication.cpp.

References c_canvasHeight, c_canvasWidth, m_canvas, and m_isFullscreen.

Referenced by registerCommands().

Here is the caller graph for this function:

void random_racer::MainApplication::autoexecCommand (  )  [private]

Runs Console::autoexec() to load the autoexec.txt again.

Definition at line 416 of file MainApplication.cpp.

References random_racer::Console::get().

Referenced by registerCommands().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_racer::MainApplication::phyDebugCommand ( const std::string &  newDebugBool  )  [private]

enable physics debug nodes

Definition at line 556 of file MainApplication.cpp.

Referenced by registerCommands().

Here is the caller graph for this function:

void random_racer::MainApplication::terDebugPlanesCommand ( const std::string &  which  )  [private]

toggles debugging of the reload planes

Definition at line 665 of file MainApplication.cpp.

References random_racer::Console::get(), and m_planes.

Referenced by registerCommands().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_racer::MainApplication::terDebugPhyCommand ( const std::string &  newBool  )  [private]

toggles if the debug body of the bottom is shown or not.

Definition at line 705 of file MainApplication.cpp.

References m_odeLoader.

Referenced by registerCommands().

Here is the caller graph for this function:

void random_racer::MainApplication::phyPerformanceAdjustCommand ( const std::string &  newBool  )  [private]

physics performance auto adjust

Definition at line 565 of file MainApplication.cpp.

References random_racer::Console::get().

Referenced by registerCommands().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_racer::MainApplication::phyStepTimeCommand ( const std::string &  newDouble  )  [private]

physics step time

Definition at line 580 of file MainApplication.cpp.

References random_racer::Console::get().

Referenced by registerCommands().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_racer::MainApplication::phyStepSizeCommand ( const std::string &  newBool  )  [private]

physics step size

Definition at line 600 of file MainApplication.cpp.

References random_racer::Console::get().

Referenced by registerCommands().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_racer::MainApplication::phyChangeTerrainCommand (  )  [private]

changes terrain, for debugging only.

should be removed soon.

void random_racer::MainApplication::collectCoinsCommand ( const std::string &  newBool  )  [private]

Enables or disabled the collecting of points.

Definition at line 714 of file MainApplication.cpp.

References m_itemDistributor.

Referenced by registerCommands().

Here is the caller graph for this function:

void random_racer::MainApplication::preStartCommand ( const std::string &  temp  )  [private]

starts the presentation

Definition at line 723 of file MainApplication.cpp.

References m_presenter.

Referenced by registerCommands().

Here is the caller graph for this function:

void random_racer::MainApplication::registerCommands (  )  [private]

Registers all commands which are more or less connectect to the members of this class at the Console.

Definition at line 297 of file MainApplication.cpp.

References autoexecCommand(), camBackCommand(), camCorrectCommand(), camFogCommand(), camResetCommand(), camStaticCommand(), camUpCommand(), carPositionCommand(), carResetCommand(), collectCoinsCommand(), fovCommand(), fullscreenCommand(), random_racer::Console::get(), phyDebugCommand(), phyPerformanceAdjustCommand(), phyStepSizeCommand(), phyStepTimeCommand(), preStartCommand(), quitCommand(), terDebugPhyCommand(), terDebugPlanesCommand(), and versionCommand().

Referenced by MainApplication().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_racer::MainApplication::updatePhysics ( int  args  )  [static]

This is the callback method of glutTimerFunc().

Parameters:
args This int gets casted to a MainApplication* and will serve as a "this" for this function.

Definition at line 271 of file MainApplication.cpp.

void random_racer::MainApplication::everyFrame ( int  args  )  [static]

Gets called with a glutTimer of 0 or so and so hopefully every frame.

Definition at line 280 of file MainApplication.cpp.

void random_racer::MainApplication::quitCommand (  ) 

The command method which gets called when the application should quit can be called from the console.

Definition at line 409 of file MainApplication.cpp.

Referenced by registerCommands().

Here is the caller graph for this function:

void random_racer::MainApplication::cleanUpAtExit (  )  [static]

This gets registered at atexit(3), so we can stop threads, etc.

Move your cleanup code to here and it should get called when the application quits.

Definition at line 729 of file MainApplication.cpp.

References m_vrsLoader, and s_daMainApp.

void random_racer::MainApplication::signalHandler ( int  sig  )  [static]

Handles SIGINT, etc so that we exit gracefully there.

Definition at line 739 of file MainApplication.cpp.


Member Data Documentation

VRS::SO<VRS::GlutCanvas> random_racer::MainApplication::m_canvas [private]

Definition at line 67 of file MainApplication.h.

Referenced by fullscreenCommand(), keyEvent(), and MainApplication().

VRS::SO<VRS::SceneThing> random_racer::MainApplication::m_scene [private]

Definition at line 68 of file MainApplication.h.

Referenced by camFogCommand(), and MainApplication().

VRS::SO<VRS::SceneThing> random_racer::MainApplication::m_geometryRoot [private]

Definition at line 68 of file MainApplication.h.

Referenced by MainApplication().

VRS::SO<VRS::SceneThing> random_racer::MainApplication::m_skyBoxThing [private]

Definition at line 68 of file MainApplication.h.

VRS::SO<VRS::LookAt> random_racer::MainApplication::m_lookAt [private]

Definition at line 69 of file MainApplication.h.

Referenced by MainApplication().

VRS::SO<VRS::Perspective> random_racer::MainApplication::m_perspective [private]

Definition at line 70 of file MainApplication.h.

Referenced by camResetCommand(), fovCommand(), keyEvent(), and MainApplication().

VRS::SO<VRS::Fog> random_racer::MainApplication::m_fog [private]

Definition at line 71 of file MainApplication.h.

Referenced by camFogCommand(), and MainApplication().

VRS::SO<VRS::BehaviorCallback> random_racer::MainApplication::m_keyCallBack [private]

Definition at line 72 of file MainApplication.h.

Referenced by keyEvent(), and MainApplication().

VRS::SO<Car> random_racer::MainApplication::m_car[2] [private]

Definition at line 73 of file MainApplication.h.

Referenced by carPositionCommand(), carResetCommand(), keyEvent(), and MainApplication().

unsigned int random_racer::MainApplication::m_activeCar [private]

Definition at line 74 of file MainApplication.h.

Referenced by carPositionCommand(), carResetCommand(), keyEvent(), and MainApplication().

double random_racer::MainApplication::m_oldFov [private]

Definition at line 75 of file MainApplication.h.

Referenced by keyEvent(), and MainApplication().

double random_racer::MainApplication::m_targetFov [private]

Definition at line 76 of file MainApplication.h.

Referenced by keyEvent().

double random_racer::MainApplication::m_lastFov [private]

Definition at line 77 of file MainApplication.h.

Referenced by keyEvent().

VRS::SO<ThirdPersonCameraHelper> random_racer::MainApplication::m_camHelper [private]

Definition at line 79 of file MainApplication.h.

Referenced by camBackCommand(), camCorrectCommand(), camDelayCommand(), camResetCommand(), camStaticCommand(), camUpCommand(), and MainApplication().

VRS::SO<TerrainGenerator> random_racer::MainApplication::m_odeGenerator [private]

Definition at line 81 of file MainApplication.h.

VRS::SO<TerrainGenerator> random_racer::MainApplication::m_vrsGenerator [private]

Definition at line 81 of file MainApplication.h.

VRS::SO<VRSTerrainLoader> random_racer::MainApplication::m_vrsLoader [private]

Definition at line 82 of file MainApplication.h.

Referenced by cleanUpAtExit(), and MainApplication().

VRS::SO<ODETerrainLoader> random_racer::MainApplication::m_odeLoader [private]

Definition at line 83 of file MainApplication.h.

Referenced by MainApplication(), and terDebugPhyCommand().

VRS::SO<LoaderGlue> random_racer::MainApplication::m_odeGlue [private]

Definition at line 84 of file MainApplication.h.

Referenced by MainApplication().

VRS::SO<LoaderGlue> random_racer::MainApplication::m_vrsGlue [private]

Definition at line 84 of file MainApplication.h.

Referenced by MainApplication().

VRS::SO<ReloadPlane> random_racer::MainApplication::m_planes[8] [private]

Definition at line 85 of file MainApplication.h.

Referenced by MainApplication(), and terDebugPlanesCommand().

VRS::SO<ControlPointGenerator> random_racer::MainApplication::m_generator [private]

Definition at line 87 of file MainApplication.h.

Referenced by MainApplication().

VRS::SO<ItemDistributor> random_racer::MainApplication::m_itemDistributor [private]

Definition at line 89 of file MainApplication.h.

Referenced by collectCoinsCommand(), and MainApplication().

bool random_racer::MainApplication::m_isFullscreen [private]

Definition at line 91 of file MainApplication.h.

Referenced by fullscreenCommand(), and MainApplication().

const double random_racer::MainApplication::c_defaultFov [static, private]

Definition at line 93 of file MainApplication.h.

Referenced by camResetCommand(), and MainApplication().

const unsigned int random_racer::MainApplication::c_canvasWidth [static, private]

Definition at line 94 of file MainApplication.h.

Referenced by fullscreenCommand(), and MainApplication().

const unsigned int random_racer::MainApplication::c_canvasHeight [static, private]

Definition at line 94 of file MainApplication.h.

Referenced by fullscreenCommand(), and MainApplication().

VRS::SO<vrsode::TriangleData> random_racer::MainApplication::m_triangleData [private]

Definition at line 96 of file MainApplication.h.

VRS::SO<ControlPointContainer> random_racer::MainApplication::m_container [private]

Definition at line 98 of file MainApplication.h.

Referenced by MainApplication().

VRS::SO<CenterScreenDisplay> random_racer::MainApplication::m_centerScreen [private]

Definition at line 100 of file MainApplication.h.

Referenced by MainApplication().

VRS::SO<Presenter> random_racer::MainApplication::m_presenter [private]

Definition at line 102 of file MainApplication.h.

Referenced by MainApplication(), and preStartCommand().

MainApplication * random_racer::MainApplication::s_daMainApp [static, private]

We need this in cleanUpAtExit() to gracefully clean up things.

Definition at line 107 of file MainApplication.h.

Referenced by cleanUpAtExit(), and MainApplication().


The documentation for this class was generated from the following files:
Generated on Fri May 11 21:02:10 2007 for Random Racer by  doxygen 1.5.1