Call this to modify the size of the Phaser canvas element directly.
You should only use this if you are using the NONE
scale mode,
it will update all internal components completely.
If all you want to do is change the size of the parent, see the setParentSize
method.
If all you want is to change the base size of the game, but still have the Scale Manager
manage all the scaling (i.e. you're not using NONE
), then see the setGameSize
method.
This method will set the gameSize
, baseSize
and displaySize
components to the given
dimensions. It will then resize the canvas width and height to the values given, by
directly setting the properties. Finally, if you have set the Scale Manager zoom value
to anything other than 1 (the default), it will set the canvas CSS width and height to
be the given size multiplied by the zoom factor (the canvas pixel size remains untouched).
If you have enabled autoCenter
, it is then passed to the updateCenter
method and
the margins are set, allowing the canvas to be centered based on its parent element
alone. Finally, the displayScale
is adjusted and the RESIZE event dispatched.
name | type | description |
---|---|---|
width | number |
The new width of the game. |
height | number |
The new height of the game. |
The Scale Manager instance.