Jump to content

Use HD sprites based on pixel density.


rcooper383
 Share

Recommended Posts

Does phaser support swapping out sprites based on pixel density? I have folders for 1X, 2X, 3X, etc and I want to preload all of the assets in that folder based on pixel density. I then want to apply a global scale so that every thing in the app is scaled correctly. I also want to design my game using a resolution of 320x480 and have all the coordinates scale as well.

I've tried using USER_SCALE but it does not appear to do anything.

Link to comment
Share on other sites

Device.pixelRatio will tell you the pixel density of the current device's screen. From there you can load the appropriate image. Phaser won't do this automatically, though, so you'll have to do the detection yourself and decide what images to load.

http://phaser.io/docs/2.4.4/Phaser.Device.html#pixelRatio

game.device.pixelRatio

 

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...