Skip to content

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.

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();
}
}
});
  • Addable

new Game(): Game

Game

static _autoDetect: Game

Defined in: system/game.ts:306

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.

number | Scene

Promise<any>

Addable.addToScene


getFpsCapture(): number

Defined in: system/game.ts:191

return: number

Get the Captured FPS of the game

number


getFpsRender(): number

Defined in: system/game.ts:182

return: number

Get the FPS Render of the game

number


getGapiType(): string

Defined in: system/game.ts:113

return: string

Gets the Graphics API type.

var gApiType = game.getGapiType();
OGL, DX8, DX8_SwapChain, DX9, DX9Ex, DX9_SwapChain,
DX9_PresentEx, DX10, DX11, DX11.1, DX11.1_Present1

string


getHandle(): number

Defined in: system/game.ts:76

return: number

Gets the Graphics API handle.

var handle = game.getHandle();

number


getImageName(): string

Defined in: system/game.ts:200

return: string

Get the image name of the game

string


getLastFrameTimestamp(): number

Defined in: system/game.ts:173

return: number

Gets timestamp of last frame in milliseconds.

var lastFrameTimestamp = game.getLastFrameTimestamp();

number


getPid(): number

Defined in: system/game.ts:61

return: number

Gets the game’s process ID.

var processId = game.getPid();

number


getReplace(): string

Defined in: system/game.ts:209

return: string

Get the replace image value of the game

string


getResolution(): Rectangle

Defined in: system/game.ts:128

return: Rectangle

Gets the game resolution in pixels.

var resolution = game.getResolution();

Rectangle


getWindowHandle(): number

Defined in: system/game.ts:91

return: number

Gets the window handle.

var windowHandle = game.getWindowHandle();

number


getWindowName(): string

Defined in: system/game.ts:158

return: string

Gets the window title

var windowName = game.getWindowName();

string


isFullscreen(): boolean

Defined in: system/game.ts:143

return: boolean

Checks if game has exclusive full screen.

var isFullscreen = game.isFullscreen();

boolean


toXML(): XML

Defined in: system/game.ts:259

return: XML

Converts Game object into an XML object

var gameXML = game.toXML();

XML


static autoDetect(): 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();

Game


static parse(jxon): Game

Defined in: system/game.ts:228

param: gameJSON

return: Game

Converts a JSON object into a Game object

var XJS = require('xjs');
var game = XJS.Game.parse(jsonObj);

JSON

Game