Jump to content

Change Phaser size without scaling


sifon
 Share

Recommended Posts

Hello all!

 

I'm having a problem developing a Phaser game for mobile devices, the aspect ratio is fixed as 4:3, so I adjust the canvas size to keep that aspect ratio. When the user is changing the orientation, the canvas is keeping the same aspect ratio but is getting bigger. My problem is when I set the new size to Phaser game object, it is upscaling the content inside and is pixelated. My code looks like this:

        var taskAspect = 4/3,            screenHeight = window.innerHeight,            screenWidth = window.innerWidth,            screenAspect = screenWidth / screenHeight;        if (screenAspect < taskAspect) {            game.width = screenWidth;            game.height = game.width / taskAspect;        } else {            game.height = screenHeight;            game.width = game.height * taskAspect;        }

My question is: is possible to change Phaser game size telling Phaser: "ey, I want to change game size but please don't scale content inside!!" ?

 
Thanks a lot!
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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