TorqueScript Reference
Functions | Variables

Functions

String getDesktopResolution ()
 
String getDisplayDeviceList ()
 
String getRes ()
 
String getResolutionList (devicename)
 
String getVideoDriverInfo ()
 
Boolean isDeviceFullScreenOnly (devicename)
 
Boolean isFullScreen ()
 
void minimizeWindow ()
 
Boolean nextResolution ()
 
Boolean prevResolution ()
 
void restoreWindow ()
 
Boolean setDisplayDevice (deviceName, [width]?, [height]?, [bpp]?, [fullScreen]?)
 
Boolean setRes (width, height, bpp)
 
Boolean setScreenMode (width, height, bpp, fullScreen)
 
Boolean setVerticalSync (enable)
 
Boolean switchBitDepth ()
 
Boolean toggleFullScreen ()
 
void videoSetGammaCorrection (gamma)
 

Variables

Boolean getVerticalSync
 

Detailed Description

Function Documentation

◆ getDesktopResolution()

String getDesktopResolution ( )

Use the getDesktopResolution function to determine the current resolution of the desktop (not the application). To get the current resolution of a windowed display of the torque game engine, simply examine the global variable '$pref::Video::resolution'.

Returns
Returns a string containing the current desktop resolution, including the width height and the current bits per pixel.
See also
getDisplayDeviceList, getResolutionList, nextResolution, prevResolution, setDisplayDevice, setRes, setScreenMode, switchBitDepth

◆ getDisplayDeviceList()

String getDisplayDeviceList ( )

Use the getDisplayDeviceList function to get a list of valid display devices.

Returns
Returns a tab separated list of valid display devices.
See also
getDesktopResolution, getResolutionList, setRes, setScreenMode, switchBitDepth

◆ getRes()

String getRes ( )

Get the width, height, and bitdepth of the screen.

Returns
A string formatted as <width> <height> <bitdepth>\

◆ getResolutionList()

String getResolutionList ( devicename  )

Use the getResolutionList function to get a semicolon separated list of legal resolutions for a specified device. Resolutions are always in the form: width height bpp, where width and height are in pixels and bpp is bits-per-pixel.

Parameters
deviceNameA string containing a supported display device.
Returns
Returns a tab separated list of valid display resolutions for devicename.
See also
getDesktopResolution, getDisplayDeviceList, setRes, setScreenMode, switchBitDepth

◆ getVideoDriverInfo()

String getVideoDriverInfo ( )

Use the getVideoDriverInfo function to dump information on the video driver to the console.

Returns
No return value

◆ isDeviceFullScreenOnly()

Boolean isDeviceFullScreenOnly ( devicename  )

Use the isDeviceFullScreenOnly function to determine if the device specified in devicename is for full screen display only, or whether it supports windowed mode too.

Parameters
deviceNameA string containing a supported display device.
Returns
Returns true if the device can only display full scree, false otherwise.
See also
getResolutionList

◆ isFullScreen()

Boolean isFullScreen ( )

Use the isFullScreen function to determine if the current application is displayed in full-screen mode.

Returns
Returns true if the engine is currently displaying full-screen, otherwise returns false

◆ minimizeWindow()

void minimizeWindow ( )

Minimize the game window

◆ nextResolution()

Boolean nextResolution ( )

Use the nextResolution function to switch to the next valid (higher) resolution for the current display device.

Returns
Returns true if switch was successful, false otherwise.
See also
getDesktopResolution, prevResolution, getResolutionList, setRes, setScreenMode, switchBitDepth

◆ prevResolution()

Boolean prevResolution ( )

Use the prevResolution function to switch to the previous valid (lower) resolution for the current display device.

Returns
Returns true if switch was successful, false otherwise.
See also
getDesktopResolution, nextResolution, getResolutionList, setRes, setScreenMode, switchBitDepth

◆ restoreWindow()

void restoreWindow ( )

Restore the game window

◆ setDisplayDevice()

Boolean setDisplayDevice ( deviceName  ,
[width] ?  ,
[height] ?  ,
[bpp] ?  ,
[fullScreen] ?   
)

Use the setDisplayDevice function to select a display device and to set the initial width, height and bits-per-pixel (bpp) setting, as well as whether the application is windowed or in fullScreen. If no resolution information is specified, the first legal resolution on this device's resolution list will be used. Furthermore, for each optional argument if the subsequent arguments are not specified, the first matching case will be used. Lastly, if the application is not told to display in full screen, but the device only supports windowed, the application will be forced into windowed mode.

Parameters
deviceNameA supported display device name.
widthResolution width in pixels.
heightResolution height in pixels.
bppPixel resolution in bits-per-pixel (16 or 32).
fullScreenA boolean value. If set to true, the application displays in full- screen mode, otherwise it will attempt to display in windowed mode.
Returns
Returns true on success, false otherwise.
See also
getDesktopResolution, getDisplayDeviceList, getResolutionList, nextResolution, prevResolution, setRes, setScreenMode, switchBitDepth

◆ setRes()

Boolean setRes ( width  ,
height  ,
bpp   
)

Use the setRes function to set the screen to the specified width, height, and bits-per-pixel (bpp).

Parameters
widthResolution width in pixels.
heightResolution height in pixels.
bppPixel resolution in bits-per-pixel (16 or 32).
Returns
Returns true if successful, otherwise false.
See also
getDesktopResolution, getDisplayDeviceList, getResolutionList, nextResolution, prevResolution, setDisplayDevice, setScreenMode, switchBitDepth

◆ setScreenMode()

Boolean setScreenMode ( width  ,
height  ,
bpp  ,
fullScreen   
)

Use the setScreenMode function to set the screen to the specified width, height, and bits-per-pixel (bpp). Additionally, if fullScreen is set to true the engine will attempt to display the application in full-screen mode, otherwise it will attempt to used windowed mode.

Parameters
widthResolution width in pixels.
heightResolution height in pixels.
bppPixel resolution in bits-per-pixel (16 or 32).
fullScreenA boolean value. If set to true, the application displays in full- screen mode, otherwise it will attempt to display in windowed mode.
Returns
Returns true if successful, otherwise false.
See also
getDesktopResolution, getDisplayDeviceList, getResolutionList, nextResolution, prevResolution, setDisplayDevice, setRes, switchBitDepth

◆ setVerticalSync()

Boolean setVerticalSync ( enable  )

Use the setVerticalSync function to force the framerate to sync up with the vertical refresh rate. This is used to reduce excessive swapping/rendering. There is generally no purpose in rendering any faster than the monitor will support. Those extra 'ergs' can be used for something else

Parameters
enableA boolean value. If set to true, the engine will only swap front and back buffers on or before a vertical refresh pass.
Returns
Returns true on success, false otherwise.

◆ switchBitDepth()

Boolean switchBitDepth ( )

Use the switchBitDepth function to toggle the bits-per-pixel (bpp) pixel resolution between 16 and 32.

Returns
Returns true on success, false otherwise.
See also
getDesktopResolution, getDisplayDeviceList, getResolutionList, nextResolution, prevResolution, setDisplayDevice, setRes

◆ toggleFullScreen()

Boolean toggleFullScreen ( )

Use the toggleFullScreen function to switch from full-screen mode to windowed, or vice versa.

Returns
Returns true on success, false otherwise

◆ videoSetGammaCorrection()

void videoSetGammaCorrection ( gamma  )

Use the videoSetGammaCorrection function to adjust the gamma for the video card. The card will revert to it's default gamma setting as long as the application closes normally

Parameters
gammaA floating-point value between 0.0 and 1.0.
Returns
No return value.

Variable Documentation

◆ getVerticalSync

Boolean getVerticalSync
Initial value:
{
return(Video::getVerticalSync())

Use the getVerticalSync function to determine if the application's framerate is currently synchronized to the vertical refresh rate.

Returns
Returns true if Vertical sync is enabled, false otherwise