Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
GameInterface Class Referenceabstract

`#include <gameInterface.h>`

Inheritance diagram for GameInterface:

## Public Member Functions
| GameInterface ()
virtual void | gameDeactivate (const bool noRender)=0
virtual void | gameReactivate (void)=0
Game Loop
virtual bool | mainInitialize (int argc, const char **argv)=0
virtual void | mainLoop (void)=0
virtual void | mainShutdown (void)=0
Platform Interface
The platform calls these functions to control execution of the game.
virtual void | textureKill (void)=0
virtual void | textureResurrect (void)=0
virtual void | refreshWindow (void)=0
virtual void | postEvent (Event &event)
| Place an event in Game's event queue. More...
virtual void | processEvents ()
| Process all the events in Game's event queue. Only the main thread should call this. More...
Event Handlers
default event behavior with journaling support default handler forwards events to appropriate routines
virtual void | processEvent (Event *event)
virtual void | processQuitEvent ()=0
virtual void | processTimeEvent (TimeEvent *event)=0
virtual void | processInputEvent (InputEvent *event)=0
virtual void | processMouseMoveEvent (MouseMoveEvent *event)=0
virtual void | processScreenTouchEvent (ScreenTouchEvent *event)=0
virtual void | processConsoleEvent (ConsoleEvent *event)=0
virtual void | processPacketReceiveEvent (PacketReceiveEvent *event)=0
virtual void | processConnectedAcceptEvent (ConnectedAcceptEvent *event)=0
virtual void | processConnectedReceiveEvent (ConnectedReceiveEvent *event)=0
virtual void | processConnectedNotifyEvent (ConnectedNotifyEvent *event)=0
Running
void | setRunning (const bool running)
bool | isRunning (void) const
void | setRestart (const bool restart)
bool | requiresRestart (void) const
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 ()
void | loadJournal (const char *fileName)
| Start loading journal data from the specified file. More...
void | saveJournal (const char *fileName)
| Start saving journal data to the specified file (must be able to write it). More...
void | playJournal (const char *fileName, bool journalBreak=false)
JournalMode | getJournalMode ()
bool | isJournalReading (void) const
| Are we reading back from the journal? More...
bool | isJournalWriting (void) const
| Are we writing to the journal? More...
void | journalRead (U32 *val)
| Read a U32 from the journal. More...
void | journalWrite (U32 val)
| Write a U32 to the journal. More...
void | journalRead (U32 size, void *buffer)
| Read a block of data from the journal. More...
void | journalWrite (U32 size, const void *buffer)
| Write a block of data to the journal. More...
FileStream * | getJournalStream (void)

## Constructor & Destructor Documentation

GameInterface | ( |  | ) |

## Member Function Documentation

virtual void gameDeactivate | ( | const bool | noRender | ) |
| pure virtual

Implemented in DefaultGame.

virtual void gameReactivate | ( | void |  | ) |
| pure virtual

Implemented in DefaultGame.

JournalMode getJournalMode | ( |  | ) |
| inline

FileStream * getJournalStream | ( | void |  | ) |

bool isJournalReading | ( | void |  | ) | const
| inline

Are we reading back from the journal?

bool isJournalWriting | ( | void |  | ) | const
| inline

Are we writing to the journal?

bool isRunning | ( | void |  | ) | const
| inline

void journalProcess | ( |  | ) |

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

void journalRead | ( | U32 * | val | ) |

Read a U32 from the journal.

void journalRead | ( | U32 | size,
|  | void * | buffer
| ) |  |

Read a block of data from the journal.

void journalWrite | ( | U32 | val | ) |

Write a U32 to the journal.

void journalWrite | ( | U32 | size,
|  | const void * | buffer
| ) |  |

Write a block of data to the journal.

void loadJournal | ( | const char * | fileName | ) |

Start loading journal data from the specified file.

virtual bool mainInitialize | ( | int | argc,
|  | const char ** | argv
| ) |  |
| pure virtual

Implemented in DefaultGame.

virtual void mainLoop | ( | void |  | ) |
| pure virtual

Implemented in DefaultGame.

virtual void mainShutdown | ( | void |  | ) |
| pure virtual

Implemented in DefaultGame.

void 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?

void postEvent | ( | Event & | event | ) |
| virtual

Place an event in Game's event queue.

virtual void processConnectedAcceptEvent | ( | ConnectedAcceptEvent * | event | ) |
| pure virtual

Implemented in DefaultGame.

virtual void processConnectedNotifyEvent | ( | ConnectedNotifyEvent * | event | ) |
| pure virtual

Implemented in DefaultGame.

virtual void processConnectedReceiveEvent | ( | ConnectedReceiveEvent * | event | ) |
| pure virtual

Implemented in DefaultGame.

virtual void processConsoleEvent | ( | ConsoleEvent * | event | ) |
| pure virtual

Implemented in DefaultGame.

void processEvent | ( | Event * | event | ) |
| virtual

void processEvents | ( |  | ) |
| virtual

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

virtual void processInputEvent | ( | InputEvent * | event | ) |
| pure virtual

Implemented in DefaultGame.

virtual void processMouseMoveEvent | ( | MouseMoveEvent * | event | ) |
| pure virtual

Implemented in DefaultGame.

virtual void processPacketReceiveEvent | ( | PacketReceiveEvent * | event | ) |
| pure virtual

Implemented in DefaultGame.

virtual void processQuitEvent | ( |  | ) |
| pure virtual

Implemented in DefaultGame.

virtual void processScreenTouchEvent | ( | ScreenTouchEvent * | event | ) |
| pure virtual

Implemented in DefaultGame.

virtual void processTimeEvent | ( | TimeEvent * | event | ) |
| pure virtual

Implemented in DefaultGame.

virtual void refreshWindow | ( | void |  | ) |
| pure virtual

Implemented in DefaultGame.

bool requiresRestart | ( | void |  | ) | const
| inline

void saveJournal | ( | const char * | fileName | ) |

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

void setRestart | ( | const bool | restart | ) |
| inline

void setRunning | ( | const bool | running | ) |
| inline

virtual void textureKill | ( | void |  | ) |
| pure virtual

Implemented in DefaultGame.

virtual void textureResurrect | ( | void |  | ) |
| pure virtual

Implemented in DefaultGame.

The documentation for this class was generated from the following files:

- game/gameInterface.h
- game/gameInterface.cc