Platform

Enumeration

enum MBButtons

Which buttons to display on a message box.

Parameters:
  • Ok
  • OkCancel
  • RetryCancel
  • SaveDontSave
  • SaveDontSaveCancel
enum MBIcons

What icon to show on a message box.

Parameters:
  • Information
  • Warning
  • Stop
  • Question
enum MBReturnVal

Return value for messageBox() indicating which button was pressed by the user.

Parameters:
  • OK
  • Cancelled
  • Retry
  • DontSave

Functions

bool displaySplashWindow(string path = "art/gui/splash.bmp")

Display a startup splash window suitable for showing while the engine still starts up.

Note: This is currently only implemented on Windows.

Returns:True if the splash window could be successfully initialized.
int getRealTime()
Returns:Return the current real time in milliseconds. Real time is platform defined; typically time since the computer booted.
int getSimTime()

Sim time is time since the game started.

Returns:Return the current sim time in milliseconds.
bool getWebDeployment()

Test whether Torque is running in web-deployment mode.

In this mode, Torque will usually run within a browser and certain restrictions apply (e.g. Torque will not be able to enter fullscreen exclusive mode).

Returns:True if Torque is running in web-deployment mode.
void gotoWebPage(string address)

Open the given URL or file in the user’s web browser.

Parameters:address – The address to open. If this is not prefixed by a protocol specifier (”...://”), then the function checks whether the address refers to a file or directory and if so, prepends “file://” to adress; if the file check fails, “http://” is prepended to address.

Example:

gotoWebPage( "http://www.garagegames.com" );
bool isDebugBuild()

Test whether the engine has been compiled with TORQUE_DEBUG, i.e. if it includes debugging functionality.

Returns:True if this is a debug build; false otherwise.
bool isShippingBuild()

Test whether the engine has been compiled with TORQUE_SHIPPING, i.e. in a form meant for final release.

Returns:True if this is a shipping build; false otherwise.
bool isToolBuild()

Test whether the engine has been compiled with TORQUE_TOOLS, i.e. if it includes tool-related functionality.

Returns:True if this is a tool build; false otherwise.
int messageBox(string title, string message, MBButtons buttons = MBOkCancel, MBIcons icons = MIInformation)

Display a modal message box using the platform’s native message box implementation.

Parameters:
  • title – The title to display on the message box window.
  • message – The text message to display in the box.
  • buttons – Which buttons to put on the message box.
  • icons – Which icon to show next to the message.
Returns:

One of $MROK, $MRCancel, $MRRetry, and $MRDontSave identifying the button that the user pressed.

Example:

messageBox( "Error", "" );
void playJournal(string filename)

Begin playback of a journal from a specified field.

Parameters:filename – Name and path of file journal file
void quit()

Shut down the engine and exit its process. This function cleanly uninitializes the engine and then exits back to the system with a process exit status indicating a clean exit.

void quitWithErrorMessage(string message)

Display an error message box showing the given message and then shut down the engine and exit its process. This function cleanly uninitialized the engine and then exits back to the system with a process exit status indicating an error.

Parameters:message – The message to log to the console and show in an error message box.
void saveJournal(string filename)

Save the journal to the specified file.

bool shellExecute(string executable, string args, string directory)

Launches an outside executable or batch file.

Parameters:
  • executable – Name of the executable or batch file
  • args – Optional list of arguments, in string format, to pass to the executable
  • directory – Optional string containing path to output or shell

Variables

int $MRCancel

Determines the cancel button press state in a message box.

int $MRDontSave

Determines the don’t save button press state in a message box.

int $MROk

Determines the ok button press state in a message box.

int $MRRetry

Determines the retry button press state in a message box.

int $platform::backgroundSleepTime

Controls processor time usage when the game window is out of focus.

int $platform::timeManagerProcessInterval

Controls processor time usage when the game window is in focus.