fkkcloud Posted March 9, 2016 Share Posted March 9, 2016 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?? Link to comment Share on other sites More sharing options...
Zeterain Posted March 10, 2016 Share Posted March 10, 2016 Looks like just 1. this.load will only be called once according to this block of code you posted. I feel like the easiest way to test this would be to just run it and see what happens. Link to comment Share on other sites More sharing options...
jouniii Posted April 7, 2016 Share Posted April 7, 2016 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 More sharing options...
VitaZheltyakov Posted April 7, 2016 Share Posted April 7, 2016 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 More sharing options...
Recommended Posts