System

The main class that manages a game.

new System(width, height, canvasId, disableClearRect)

Parameters:
Name Type Description
width Number A width of the game
height Number A height of the game
canvasId String An id of canvas element for the game
disableClearRect Boolean If true the system will not call clearRect. If the game has a not opaque background, it is better to be true in terms of its performance.

Methods

getCanvas() → {HTMLCanvasElement}

Returns the canvas element.

Returns:
HTMLCanvasElement The canvas element of the game

getFps() → {Number}

Returns an actual FPS.

Returns:
Number FPS

getHeight() → {Number}

Returns the height of the canvas element.

Returns:
Number The height of the canvas element

getImage(path, localPosArr) → {arc.Image}

Returns Image object from its list of loaded images. It uses a ImageManager object so the usage is same.

Parameters:
Name Type Description
path String A url of the image
localPosArr Array An array of local position and size of the image in a format like [x, y, width, height]. If the parameter is specified, it returns a clipped Image object.(Optional)
Returns:
arc.Image A loaded Image object
Example
var img = system.getImage('a.png', [10, 10, 100, 100]);

getStage() → {DisplayObject}

Returns the Stage object, which is the root of all display objects.

Returns:
DisplayObject The Stage object

getWidth() → {Number}

Returns the width of the canvas element.

Returns:
Number The width of the canvas element

load(resourceArr)

Starts to load the images via ImageManger.

Parameters:
Name Type Description
resourceArr Array An array of urls of the images

setFullScreen(mode, shouldShrink)

指定したフルスクリーンモードにする。デバイスを回転させた時にも適用される。 Enables a specified full screen mode. There are 3 types of full screen mode "width", "height" and "all". "width" mode keeps its aspect ratio and fits its width to the width of the screen. "height" mode keeps its aspect ratio and fits its height to the height of the screen. "all" mode keeps its aspect ratio and shows all contents in the screen.

Parameters:
Name Type Description
mode String A full screen mode "width", "height" or "all".
shouldShrink Boolean If true the game will be shrunk when the size of the screen is smaller than the size of the game.
Example
system.setFullScreen("width");		//Keeps its aspect ratio and fits its width to the width of the screen
system.setFullScreen("height");		//Keeps its aspect ratio and fits its height to the height of the screen
system.setFullScreen("all", true);	//Keeps its aspect ratio and shows all contents in the screen

setGameClass(gameClass, gameParams)

Sets a main class of the game which extends Game class.

Parameters:
Name Type Description
gameClass Function A main game class
gameParams Object A initial parameters

start()

Starts the game.

stop()

Stops the game.