new Stage(game, width, height)
The Stage controls the canvas on which everything is displayed. It handles display within the browser, focus handling, game resizing, scaling and the pause, boot and orientation screens.
Parameters:
Name | Type | Description |
---|---|---|
game |
Phaser.Game | Game reference to the currently running game. |
width |
number | Width of the canvas element. |
height |
number | Height of the canvas element. |
- Source:
Extends
- PIXI.Stage
Members
-
backgroundColor
-
- Source:
Properties:
Name Type Description backgroundColor
number | string Gets and sets the background color of the stage. The color can be given as a number: 0xff0000 or a hex string: '#ff0000'
-
checkOffsetInterval
-
- Default Value:
- 2500
- Source:
Properties:
Name Type Description checkOffsetInterval
number | false The time (in ms) between which the stage should check to see if it has moved.
-
disableVisibilityChange
-
- Default Value:
- false
- Source:
Properties:
Name Type Description disableVisibilityChange
boolean By default if the browser tab loses focus the game will pause. You can stop that behaviour by setting this property to true.
-
exists
-
- Default Value:
- true
- Source:
Properties:
Name Type Description exists
boolean If exists is true the Stage and all children are updated, otherwise it is skipped.
-
game
-
- Source:
Properties:
Name Type Description game
Phaser.Game A reference to the currently running Game.
-
name
-
- Default Value:
- "_stage_root"
- Source:
Properties:
Name Type Description name
string The name of this object.
-
offset
-
- Source:
Properties:
Name Type Description offset
Phaser.Point Holds the offset coordinates of the Game.canvas from the top-left of the browser window (used by Input and other classes)
-
setBackgroundColor
-
Sets the background color for the stage.
- Source:
Methods
-
checkVisibility()
-
Starts a page visibility event listener running, or window.blur/focus if not supported by the browser.
- Source:
-
<protected> parseConfig()
-
Parses a Game configuration object.
- Source:
-
postUpdate()
-
This is called automatically before the renderer runs and after the plugins have updated. In postUpdate this is where all the final physics calculatations and object positioning happens. The objects are processed in the order of the display list. The only exception to this is if the camera is following an object, in which case that is updated first.
- Source:
-
preUpdate()
-
This is called automatically after the plugins preUpdate and before the State.update. Most objects have preUpdate methods and it's where initial movement and positioning is done.
- Source:
-
update()
-
This is called automatically after the State.update, but before particles or plugins update.
- Source:
-
update()
-
Runs Stage processes that need periodic updates, such as the offset checks.
- Source:
-
visibilityChange(event)
-
This method is called when the document visibility is changed.
Parameters:
Name Type Description event
Event Its type will be used to decide whether the game should be paused or not.
- Source: