Class: Graphics

Graphics()

new Graphics()

The static class that carries out graphics processing.
Properties:
Name Type Description
BLEND_ADD Number [static] The alias of PIXI.blendModes.ADD.
BLEND_NORMAL Number [static] The alias of PIXI.blendModes.NORMAL.
BLEND_MULTIPLY Number [static] The alias of PIXI.blendModes.MULTIPLY.
BLEND_SCREEN Number [static] The alias of PIXI.blendModes.SCREEN.
frameCount Number [static] The total frame count of the game screen.
width Number [static] The width of the game screen.
height Number [static] The height of the game screen.
boxWidth Number [static] The width of the window display area.
boxHeight Number [static] The height of the window display area.
scale Number [static] The zoom scale of the game screen.

Methods

(static) callGC()

Calls pixi.js garbage collector

(static) canPlayVideoType(type) → {Boolean}

Checks whether the browser can play the specified video type.
Parameters:
Name Type Description
type String The video type to test support for
Returns:
True if the browser can play the specified video type
Type
Boolean

(static) canUseCssFontLoading()

(static) canUseDifferenceBlend() → {Boolean}

Checks whether the canvas blend mode 'difference' is supported.
Returns:
True if the canvas blend mode 'difference' is supported
Type
Boolean

(static) canUseSaturationBlend() → {Boolean}

Checks whether the canvas blend mode 'saturation' is supported.
Returns:
True if the canvas blend mode 'saturation' is supported
Type
Boolean

(static) endLoading()

Erases the "Now Loading" image.

(static) eraseLoadingError()

Erases the loading error text.

(static) hasWebGL() → {Boolean}

Checks whether the current browser supports WebGL.
Returns:
True if the current browser supports WebGL.
Type
Boolean

(static) hideFps()

Hides the FPSMeter element.

(static) initialize(width, height, type)

Initializes the graphics system.
Parameters:
Name Type Description
width Number The width of the game screen
height Number The height of the game screen
type String The type of the renderer. 'canvas', 'webgl', or 'auto'.

(static) isFontLoaded(name) → {Boolean}

Checks whether the font file is loaded.
Parameters:
Name Type Description
name String The face name of the font
Returns:
True if the font file is loaded
Type
Boolean

(static) isInsideCanvas(x, y) → {Boolean}

Checks whether the specified point is inside the game canvas area.
Parameters:
Name Type Description
x Number The x coordinate on the canvas area
y Number The y coordinate on the canvas area
Returns:
True if the specified point is inside the game canvas area
Type
Boolean

(static) isVideoPlaying() → {Boolean}

Checks whether the video is playing.
Returns:
True if the video is playing
Type
Boolean

(static) isWebGL() → {Boolean}

Checks whether the renderer type is WebGL.
Returns:
True if the renderer type is WebGL
Type
Boolean

(static) loadFont(name, url)

Loads a font file.
Parameters:
Name Type Description
name String The face name of the font
url String The url of the font file

(static) pageToCanvasX(x) → {Number}

Converts an x coordinate on the page to the corresponding x coordinate on the canvas area.
Parameters:
Name Type Description
x Number The x coordinate on the page to be converted
Returns:
The x coordinate on the canvas area
Type
Number

(static) pageToCanvasY(y) → {Number}

Converts a y coordinate on the page to the corresponding y coordinate on the canvas area.
Parameters:
Name Type Description
y Number The y coordinate on the page to be converted
Returns:
The y coordinate on the canvas area
Type
Number

(static) playVideo(src)

Starts playback of a video.
Parameters:
Name Type Description
src String

(static) printError(name, message)

Displays the error text to the screen.
Parameters:
Name Type Description
name String The name of the error
message String The message of the error

(static) printLoadingError(url)

Displays the loading error text to the screen.
Parameters:
Name Type Description
url String The url of the resource failed to load

(static) render(stage)

Renders the stage to the game screen.
Parameters:
Name Type Description
stage Stage The stage object to be rendered

(static) setLoadingImage()

Sets the source of the "Now Loading" image.

(static) setVideoVolume(value)

Sets volume of a video.
Parameters:
Name Type Description
value Number

(static) showFps()

Shows the FPSMeter element.

(static) startLoading()

Initializes the counter for displaying the "Now Loading" image.

(static) tickEnd()

Marks the end of each frame for FPSMeter.

(static) tickStart()

Marks the beginning of each frame for FPSMeter.

(static) updateLoading()

Increments the loading counter and displays the "Now Loading" image if necessary.