Jump to content

Phaser 3 Sizes all wrong on High DPI screen


Recommended Posts

Hi, Phaser newbie here. So I was trying to make a very basic Phaser game where there are sprites falling from the sky and the play attempts to catch them. However, I've run into a problem regarding sizes and coordinates. My game is 240px by 480px. I have a image which is 24x24 px. I want to load this image and scale it to fit the game's width and height. Which means a scaleX of 10 and scaleY of 20. But, when I do this, it only covers one half of the width and height of the canvas being displayed. (See screenshot below.) I suspect this is something to do with my high DPI screen. But window.devicePixelRatio is 1.5 (not 2 as would be expected from this behaviour). Am I doing something wrong? Please help since I couldn't find anything similar after searching Google.



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.

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.


  • Recently Browsing   0 members

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