Game
Defined in: system/game.ts:34
The Game Class is the object returned by #system/System System Class getGames method. It provides you with methods to fetch the game object’s attributes, as well as methods to add any game to the current scene.
Basic Usage
Section titled “Basic Usage”var XJS = require('xjs');var System = XJS.System;var xml;
System.getGames().then(function(games) { for (var i in games) { if(games[i].isFullscreen()) { games[i].addToScene(); } }});Implements
Section titled “Implements”Addable
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Game():
Game
Returns
Section titled “Returns”Game
Properties
Section titled “Properties”_autoDetect
Section titled “_autoDetect”
static_autoDetect:Game
Defined in: system/game.ts:306
Methods
Section titled “Methods”addToScene()
Section titled “addToScene()”addToScene(
value?):Promise<any>
Defined in: system/game.ts:291
param: (value?: number | Scene)
return: Promise<any>Adds this game to the current scene by default. Accepts an optional parameter value, which, when supplied, points to the scene where item will be added instead. If ready config {listenToItemAdd: true} it returns item id, else returns boolean.
Note: There is yet no way to detect error responses for this action.
Parameters
Section titled “Parameters”value?
Section titled “value?”number | Scene
Returns
Section titled “Returns”Promise<any>
Implementation of
Section titled “Implementation of”Addable.addToScene
getFpsCapture()
Section titled “getFpsCapture()”getFpsCapture():
number
Defined in: system/game.ts:191
return: number
Get the Captured FPS of the game
Returns
Section titled “Returns”number
getFpsRender()
Section titled “getFpsRender()”getFpsRender():
number
Defined in: system/game.ts:182
return: number
Get the FPS Render of the game
Returns
Section titled “Returns”number
getGapiType()
Section titled “getGapiType()”getGapiType():
string
Defined in: system/game.ts:113
return: string
Gets the Graphics API type.
var gApiType = game.getGapiType();Possible Values
Section titled “Possible Values”OGL, DX8, DX8_SwapChain, DX9, DX9Ex, DX9_SwapChain,DX9_PresentEx, DX10, DX11, DX11.1, DX11.1_Present1Returns
Section titled “Returns”string
getHandle()
Section titled “getHandle()”getHandle():
number
Defined in: system/game.ts:76
return: number
Gets the Graphics API handle.
var handle = game.getHandle();Returns
Section titled “Returns”number
getImageName()
Section titled “getImageName()”getImageName():
string
Defined in: system/game.ts:200
return: string
Get the image name of the game
Returns
Section titled “Returns”string
getLastFrameTimestamp()
Section titled “getLastFrameTimestamp()”getLastFrameTimestamp():
number
Defined in: system/game.ts:173
return: number
Gets timestamp of last frame in milliseconds.
var lastFrameTimestamp = game.getLastFrameTimestamp();Returns
Section titled “Returns”number
getPid()
Section titled “getPid()”getPid():
number
Defined in: system/game.ts:61
return: number
Gets the game’s process ID.
var processId = game.getPid();Returns
Section titled “Returns”number
getReplace()
Section titled “getReplace()”getReplace():
string
Defined in: system/game.ts:209
return: string
Get the replace image value of the game
Returns
Section titled “Returns”string
getResolution()
Section titled “getResolution()”getResolution():
Rectangle
Defined in: system/game.ts:128
return: Rectangle
Gets the game resolution in pixels.
var resolution = game.getResolution();Returns
Section titled “Returns”getWindowHandle()
Section titled “getWindowHandle()”getWindowHandle():
number
Defined in: system/game.ts:91
return: number
Gets the window handle.
var windowHandle = game.getWindowHandle();Returns
Section titled “Returns”number
getWindowName()
Section titled “getWindowName()”getWindowName():
string
Defined in: system/game.ts:158
return: string
Gets the window title
var windowName = game.getWindowName();Returns
Section titled “Returns”string
isFullscreen()
Section titled “isFullscreen()”isFullscreen():
boolean
Defined in: system/game.ts:143
return: boolean
Checks if game has exclusive full screen.
var isFullscreen = game.isFullscreen();Returns
Section titled “Returns”boolean
toXML()
Section titled “toXML()”toXML():
XML
Defined in: system/game.ts:259
return: XML
Converts Game object into an XML object
var gameXML = game.toXML();Returns
Section titled “Returns”XML
autoDetect()
Section titled “autoDetect()”
staticautoDetect():Game
Defined in: system/game.ts:322
return: Game
Returns a special Game object that may be added to the stage. This object automatically detects any compatible games that are running and focused, and changes the displayed game on the stage accordingly.
var xjs = require('xjs');xjs.Game.autoDetect().addToScene();Returns
Section titled “Returns”Game
parse()
Section titled “parse()”
staticparse(jxon):Game
Defined in: system/game.ts:228
param: gameJSON
return: GameConverts a JSON object into a Game object
var XJS = require('xjs');var game = XJS.Game.parse(jsonObj);Parameters
Section titled “Parameters”JSON
Returns
Section titled “Returns”Game