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'
-
bounds
-
- Source:
Properties:
Name Type Description bounds
Phaser.Rectangle The bounds of the Stage. Typically x/y = Stage.offset.x/y and the width/height match the game width and height.
-
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.
-
currentRenderOrderID
-
- Source:
Properties:
Name Type Description currentRenderOrderID
number Reset each frame, keeps a count of the total number of objects updated.
-
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. The color can be given as a hex value (#RRGGBB) or a numeric value (0xRRGGBB)
- Source:
-
smoothed
-
Enable or disable texture smoothing for all objects on this Stage. Only works for bitmap/image textures. Smoothing is enabled by default.
- Source:
Properties:
Name Type Description smoothed
boolean Set to true to smooth all sprites rendered on this Stage, or false to disable smoothing (great for pixel art)
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:
-
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: