TorqueScript Reference

- Main Page
- Related Pages
- Modules
- Classes

Functions
Video
Function Categories

## 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)

## Detailed Description

## Function Documentation

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

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

String getRes | ( |  | ) |

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

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

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

  deviceName | A 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

String getVideoDriverInfo | ( |  | ) |

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

Returns
  No return value

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

  deviceName | A string containing a supported display device.

Returns
  Returns true if the device can only display full scree, false otherwise.

See also
  getResolutionList

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

void minimizeWindow | ( |  | ) |

Minimize the game window

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

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

void restoreWindow | ( |  | ) |

Restore the game window

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

  deviceName | A supported display device name.
  width | Resolution width in pixels.
  height | Resolution height in pixels.
  bpp | Pixel resolution in bits-per-pixel (16 or 32).
  fullScreen | A 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

Boolean setRes | ( | width | ,
|  | height | ,
|  | bpp |
| ) |  |

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

Parameters

  width | Resolution width in pixels.
  height | Resolution height in pixels.
  bpp | Pixel 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

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

  width | Resolution width in pixels.
  height | Resolution height in pixels.
  bpp | Pixel resolution in bits-per-pixel (16 or 32).
  fullScreen | A 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

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

  enable | A 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.

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

Boolean toggleFullScreen | ( |  | ) |

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

Returns
  Returns true on success, false otherwise

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

  gamma | A floating-point value between 0.0 and 1.0.

Returns
  No return value.