Jump to content

How to scale a game to fit different screen resolutions?


toto88x
 Share

Recommended Posts

Hello,

 

I'm starting to port one of my Phaser desktop game to smartphones. And I'd like to know how to make the game look great on different smartphones with different screen resolutions. I've seen this question a few time on this forum, but couldn't find a definite answer.

 

So let's try to make things simple with an example:

 

- The game is 800x500px in landscape. It's made with Phaser, and can use cocoonjs if it helps.

- The game should look great on an iPhone 5 (1136x640), and on a galaxy S3 (1280x720)

- The game should't be cropped

- The game should be fullscreen

- We can add black borders around the game to keep the original aspect ratio (or even better, extend the background of the game)

 

How would you do that? I have a hard time grasping everything related to stage.scale, stage.scaleMode, window.devicePixelRatio, window.innerWidth, etc.

 

Thanks for your help! :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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