torque Torque Game Engine Documentation
TGE Version 1.5.2

GameInterface Class Reference

#include <gameInterface.h>

Inheritance diagram for GameInterface:

Inheritance graph
[legend]

Public Member Functions

 GameInterface ()
Platform Interface
The platform calls these functions to control execution of the game.

virtual int main (int argc, const char **argv)
virtual void textureKill ()
virtual void textureResurrect ()
virtual void refreshWindow ()
virtual void postEvent (Event &event)
 Place an event in Game's event queue.
virtual void processEvents ()
 Process all the events in Game's event queue. Only the main thread should call this.
Event Handlers
default event behavior with journaling support default handler forwards events to appropriate routines

virtual void processEvent (Event *event)
virtual void processPacketReceiveEvent (PacketReceiveEvent *event)
virtual void processMouseMoveEvent (MouseMoveEvent *event)
virtual void processInputEvent (InputEvent *event)
virtual void processQuitEvent ()
virtual void processTimeEvent (TimeEvent *event)
virtual void processConsoleEvent (ConsoleEvent *event)
virtual void processConnectedAcceptEvent (ConnectedAcceptEvent *event)
virtual void processConnectedReceiveEvent (ConnectedReceiveEvent *event)
virtual void processConnectedNotifyEvent (ConnectedNotifyEvent *event)
Running
void setRunning (bool running)
bool isRunning ()
void setRestart (bool restart)
bool requiresRestart ()
Journaling
Journaling is used in order to make a "demo" of the actual game.

It logs all processes that happen throughout code execution (NOT script). This is very handy for debugging. Say an end user finds a crash in the program. The user can start up the engine with journal recording enabled, reproduce the crash, then send in the journal file to the development team. The development team can then play back the journal file and see exactly what happened to cause the crash. This will result in the ability to run the program through the debugger to easily track what went wrong and easily create a stack trace.

Actually enabling journaling may be different in different distributions if the developers decided to change how it works. However, by default, run the program with the "-jSave filename" command argument. The filename does not need an extension, and only requires write access. If the file does not exist, it will be created. In order to play back a journal, use the "-jPlay filename" command argument, and just watch the magic happen. Examples:

 torqueDemo_DEBUG.exe -jSave crash
 torqueDemo_DEBUG.exe -jPlay crash


void journalProcess ()
 If we're doing a journal playback, this function is responsible for reading events from the journal file and dispatching them.
void loadJournal (const char *fileName)
 Start loading journal data from the specified file.
void saveJournal (const char *fileName)
 Start saving journal data to the specified file (must be able to write it).
void playJournal (const char *fileName, bool journalBreak=false)
 Play back the specified journal.
JournalMode getJournalMode ()
bool isJournalReading ()
 Are we reading back from the journal?
bool isJournalWriting ()
 Are we writing to the journal?
void journalRead (U32 *val)
 Read a U32 from the journal.
void journalWrite (U32 val)
 Write a U32 to the journal.
void journalRead (U32 size, void *buffer)
 Read a block of data from the journal.
void journalWrite (U32 size, const void *buffer)
 Write a block of data to the journal.
FileStreamgetJournalStream ()

Private Types

enum  JournalMode {
  JournalOff,
  JournalSave,
  JournalPlay
}

Private Attributes

JournalMode mJournalMode
bool mRunning
bool mJournalBreak
bool mRequiresRestart
Vector< Event * > eventQueue1
 Events are stored here by any thread, for processing by the main thread.
Vector< Event * > eventQueue2
Vector< Event * > * eventQueue

Member Enumeration Documentation

Enumerator:
JournalOff 
JournalSave 
JournalPlay 


Constructor & Destructor Documentation

GameInterface::GameInterface (  ) 


Member Function Documentation

virtual int GameInterface::main ( int  argc,
const char **  argv 
) [virtual]

Reimplemented in DemoGame.

virtual void GameInterface::textureKill (  )  [virtual]

Reimplemented in DemoGame.

virtual void GameInterface::textureResurrect (  )  [virtual]

Reimplemented in DemoGame.

virtual void GameInterface::refreshWindow (  )  [virtual]

Reimplemented in DemoGame.

virtual void GameInterface::postEvent ( Event event  )  [virtual]

Place an event in Game's event queue.

virtual void GameInterface::processEvents (  )  [virtual]

Process all the events in Game's event queue. Only the main thread should call this.

virtual void GameInterface::processEvent ( Event event  )  [virtual]

virtual void GameInterface::processPacketReceiveEvent ( PacketReceiveEvent event  )  [virtual]

Reimplemented in DemoGame.

virtual void GameInterface::processMouseMoveEvent ( MouseMoveEvent event  )  [virtual]

Reimplemented in DemoGame.

virtual void GameInterface::processInputEvent ( InputEvent event  )  [virtual]

Reimplemented in DemoGame.

virtual void GameInterface::processQuitEvent (  )  [virtual]

Reimplemented in DemoGame.

virtual void GameInterface::processTimeEvent ( TimeEvent event  )  [virtual]

Reimplemented in DemoGame.

virtual void GameInterface::processConsoleEvent ( ConsoleEvent event  )  [virtual]

Reimplemented in DemoGame.

virtual void GameInterface::processConnectedAcceptEvent ( ConnectedAcceptEvent event  )  [virtual]

Reimplemented in DemoGame.

virtual void GameInterface::processConnectedReceiveEvent ( ConnectedReceiveEvent event  )  [virtual]

Reimplemented in DemoGame.

virtual void GameInterface::processConnectedNotifyEvent ( ConnectedNotifyEvent event  )  [virtual]

Reimplemented in DemoGame.

void GameInterface::setRunning ( bool  running  )  [inline]

bool GameInterface::isRunning (  )  [inline]

void GameInterface::setRestart ( bool  restart  )  [inline]

bool GameInterface::requiresRestart (  )  [inline]

void GameInterface::journalProcess (  ) 

If we're doing a journal playback, this function is responsible for reading events from the journal file and dispatching them.

void GameInterface::loadJournal ( const char *  fileName  ) 

Start loading journal data from the specified file.

void GameInterface::saveJournal ( const char *  fileName  ) 

Start saving journal data to the specified file (must be able to write it).

void GameInterface::playJournal ( const char *  fileName,
bool  journalBreak = false 
)

Play back the specified journal.

Parameters:
fileName Journal file to play back.
journalBreak Should we break execution after we're done?

JournalMode GameInterface::getJournalMode (  )  [inline]

bool GameInterface::isJournalReading (  )  [inline]

Are we reading back from the journal?

bool GameInterface::isJournalWriting (  )  [inline]

Are we writing to the journal?

void GameInterface::journalRead ( U32 val  ) 

Read a U32 from the journal.

void GameInterface::journalWrite ( U32  val  ) 

Write a U32 to the journal.

void GameInterface::journalRead ( U32  size,
void buffer 
)

Read a block of data from the journal.

void GameInterface::journalWrite ( U32  size,
const void buffer 
)

Write a block of data to the journal.

FileStream* GameInterface::getJournalStream (  ) 


Field Documentation

bool GameInterface::mRunning [private]

Events are stored here by any thread, for processing by the main thread.




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen