fkkcloud

image loading per devicePixel data question!

Recommended Posts

Note that devicePixelRatio can be fractional and the loaded asset base texture does not get it's resolution set. Right now easiest is to post process the cache entries in game.cache._cache.image. There's no callback for this. Check the object's url for the resolution key and set object.base.resolution. Also you need to create the Phaser game with resolution option. This way the higher resolution works pretty much automatically and all game code is written as-if you had only 1x assets and coordinates, even if resolutions would be fractional and you'd mix different resolution textures. 

 

Share this post


Link to post
Share on other sites
On 09.03.2016 at 10:28 PM, fkkcloud said:

Hi,

If I am loading asset sprite image per devicePixel like 


if (window.devicePixelRatio === 3)
   this.load('assets/image@3.png')
else if (window.devicePixelRatio === 2)
   this.load('assets/image@2.png')
else
   this.load('assets/image.png')

would this cause downloading all 3 image from server or just 1??

This is a bad approach. It is necessary to use one of its asset and scale him

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.