Jump to content

image loading per devicePixel data question!


fkkcloud
 Share

Recommended Posts

  • 4 weeks later...

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. 

 

Link to comment
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/[email protected]')
else if (window.devicePixelRatio === 2)
   this.load('assets/[email protected]')
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

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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