Torque2D Reference
|
#include <gameInterface.h>
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) |
GameInterface | ( | ) |
|
pure virtual |
Implemented in DefaultGame.
|
pure virtual |
Implemented in DefaultGame.
|
inline |
FileStream * getJournalStream | ( | void | ) |
|
inline |
Are we reading back from the journal?
|
inline |
Are we writing to the journal?
|
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.
|
pure virtual |
Implemented in DefaultGame.
|
pure virtual |
Implemented in DefaultGame.
|
pure virtual |
Implemented in DefaultGame.
void playJournal | ( | const char * | fileName, |
bool | journalBreak = false |
||
) |
Play back the specified journal.
fileName | Journal file to play back. |
journalBreak | Should we break execution after we're done? |
|
virtual |
Place an event in Game's event queue.
|
pure virtual |
Implemented in DefaultGame.
|
pure virtual |
Implemented in DefaultGame.
|
pure virtual |
Implemented in DefaultGame.
|
pure virtual |
Implemented in DefaultGame.
|
virtual |
|
virtual |
Process all the events in Game's event queue. Only the main thread should call this.
|
pure virtual |
Implemented in DefaultGame.
|
pure virtual |
Implemented in DefaultGame.
|
pure virtual |
Implemented in DefaultGame.
|
pure virtual |
Implemented in DefaultGame.
|
pure virtual |
Implemented in DefaultGame.
|
pure virtual |
Implemented in DefaultGame.
|
pure virtual |
Implemented in DefaultGame.
|
inline |
void saveJournal | ( | const char * | fileName | ) |
Start saving journal data to the specified file (must be able to write it).
|
inline |
|
inline |
|
pure virtual |
Implemented in DefaultGame.
|
pure virtual |
Implemented in DefaultGame.