Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Resizing the canvas itself, not the game


slingchilders
 Share

Recommended Posts

How would I handle resizing the canvas? I try doing this on window resize, but the game is stretched very weirdly. I don't want to scale the game, just show more of it when the window and the game area becomes bigger/smaller?

            this.game.width = this.canvasWidth;
            this.game.height = this.canvasHeight;
            this.game.canvas.width = this.canvasWidth;
            this.game.canvas.height = this.canvasHeight;
            this.game.renderer.resize(this.canvasWidth , this.canvasHeight);
            this.game.scale.refresh();
 
// If i leave just this the game behaves as expected when resizing from bigger view to smaller, but when the game is loaded in a small window, and then resized to a bigger one, the canvas has margins set to never exceed the initial size, how can I fix it?
this.game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
 
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...