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:
Members
-
aspectRatio
-
- Source:
Properties:
Name Type Description aspectRatio
number Aspect ratio.
-
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'
-
canvas
-
- Source:
Properties:
Name Type Description canvas
HTMLCanvasElement Reference to the newly created
canvas
element. -
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.
-
display
-
- Source:
Properties:
Name Type Description display
PIXI.Stage The Pixi Stage which is hooked to the renderer.
-
game
-
- Source:
Properties:
Name Type Description game
Phaser.Game A reference to the currently running Game.
-
offset
-
- Source:
Properties:
Name Type Description offset
Phaser.Point Get the offset values (for input and other things).
-
scale
-
- Source:
Properties:
Name Type Description scale
Phaser.StageScaleMode The scale of the current running game.
-
scaleMode
-
- Source:
Properties:
Name Type Description scaleMode
number The current scaleMode.
Methods
-
<protected> parseConfig()
-
Parses a Game configuration object.
- 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: