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 aspectRationumber Aspect ratio.
-
backgroundColor
-
- Source:
Properties:
Name Type Description backgroundColornumber | 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 canvasHTMLCanvasElement Reference to the newly created <canvas> element.
-
checkOffsetInterval
-
- Default Value:
- 2500
- Source:
Properties:
Name Type Description checkOffsetIntervalnumber | false The time (in ms) between which the stage should check to see if it has moved.
-
game
-
- Source:
Properties:
Name Type Description gamePhaser.Game A reference to the currently running Game.
-
offset
-
- Source:
Properties:
Name Type Description offsetPhaser.Point Get the offset values (for input and other things).
-
scale
-
- Source:
Properties:
Name Type Description scalePhaser.StageScaleMode The scale of the current running game.
-
scaleMode
-
- Source:
Properties:
Name Type Description scaleModenumber The current scaleMode.
Methods
-
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 eventEvent Its type will be used to decide whether the game should be paused or not.
- Source: