Skip to content

Commit d4d2b21

Browse files
committed
Added Game.resize to help with resizing the game config, renderer and input in one
1 parent 0144bad commit d4d2b21

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/boot/Game.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,26 @@ var Game = new Class({
444444
this.loop.focus();
445445
},
446446

447+
/**
448+
* Updates the Game Config with the new width and height values given.
449+
* Then resizes the Renderer and Input Manager scale.
450+
*
451+
* @method Phaser.Game#resize
452+
* @since 3.2.0
453+
*
454+
* @param {number} width - The new width of the game.
455+
* @param {number} height - The new height of the game.
456+
*/
457+
resize: function (width, height)
458+
{
459+
this.config.width = width;
460+
this.config.height = height;
461+
462+
this.renderer.resize(width, height);
463+
464+
this.input.resize();
465+
},
466+
447467
/**
448468
* Destroys this Phaser.Game instance, all global systems, all sub-systems and all Scenes.
449469
*

0 commit comments

Comments
 (0)