Closed alamboley closed 9 years ago
Ok, got it from there: #1621 You should update the book ;)
It rises me an other issue, PixiJS only manages 1 and @2x ; so how could I manage many assets scales from [0.25,0.375,0.5,0.75,1] ; from iPhone 3GS, iPhone retina, iPhone 6(+), iPad retina... Obviously, I will put android devices resolutions close to the iOS one corresponding.
Any ideas guys? @GoodBoyDigital @englercj
Maybe we should add into Texture a scale. If Pixi's texture have a scale, it enables us to have the same image size no matter the image resolution used.
Example : I designed my image for the iPad retina, it's 100 x 100. I defined it as a 4x. Now on an iPhone 3GS, I load the 1x, but I want it to be reported as a 100 x 100 so I won't fight with positionning...
Does that make sense? At that time we're fighting fiercely with our more than 2 assets resolutions.
-> Maybe a Texture could have a scale property (as well as resolution).
if my source image represents a half scale asset, (low resolution texture) , I could tell Texture it has a scale of .5 . The source's width/height would be multiplied by 2 (1/.5) when calculating its uv... Essentially having a low res version of that asset - but that would also let us load any arbtirary scale of textures, and still work with the same units and never have to change our code (only the texture scales when its fit to load higher quality textures).
Hey there this has been addressed in v3
bg_zone_1@0.5x.png <- that would be a resolution of 0.5;
Hi @GoodBoyDigital ,
Thanks for the reply, this is great news. Am I correct to assume that whatever the resolution of a texture, its representation in the form of a Sprite for example, if no transformation is done on the stage, itself, and any parent in between, said sprite would appear at exactly the same size (and report the same width/height) as if its texture was at resolution 1 ? (just need a confirmation sorry if I'm repetitive)
if so this is amazingly helpful for multi-resolution/multi-device/multi-screen whatever we want to call it, as well as not having to just use letterbox mode or just scale everything with the game's resolution.
my only wish would be to have resolution specifically aimed at using different assets for different screen pixel 'densities' if you will, and having a different factor with a different name , like "scale" which in that case is really about different screen or window or browser size and a scale for textures. It's the same in the end really (in fact they would be mulitplied together I guess) but the word "resolution" I find can be confusing when using this property for different purposes as it was designed for.
So now I'd like to hear about Phaser and its position on this, as in my project as far as I can tell, this is not yet working (Phaser 2.3) I do see the pixi package having the right code for @2x for example (so older than v3) , in PIXI.BaseTexture.fromImage however this specific function is never called in my project - looking at Phaser.Loader/Phaser.Cache, it seems Phaser creates its BaseTextures/Texture in its own way - and just apparently not taking resolution of textures (into account. Please do correct me if I'm wrong, I've spent time looking at the source of master and dev branch as well but this must already be clear to frequent contributors.
Confirming that it isn't available yet at least would let me know I'm not doing anything wrong - appart from reading the source code clearly wrong then which is very very likely.
Anyway thank you very much for your time, have a nice day !
cc @photonstorm ,
Am I correct to assume that whatever the resolution of a texture, its representation in the form of a Sprite for example, if no transformation is done on the stage, itself, and any parent in between, said sprite would appear at exactly the same size (and report the same width/height) as if its texture was at resolution 1 ? (just need a confirmation sorry if I'm repetitive)
yes, this is now how it now works :) different resolutions will always have the same width/ height once in pixi.
I have no plans on addressing this in Phaser 2.x, sorry. It's too much of an internal change. If that means you need to build your game natively in Pixi 3 when it's released and stop using Phaser then I can fully understand that. Equally if someone wants to add the feature and submit a PR I'd be up for that too.
Thanks for the clarification. We started looking into the Phaser core but it sounded complicated since we don't master yet the Phaser internal architecture. You confirmed that it would be complicated to include due to the many internal change involved.
Unfortunately, we already spent lot of time on this multi scale assets subject. So we'll just use a scale factor everywhere for the moment, but I hope you plan to add this in Phaser 3. I think it's really important for :
Thanks again to both of you for your hard work.
In order to keep the Github issues clear this feature request has been moved to the Phaser 3 wishlist.
Hey there,
In PixiJS we have a resolution argument in its constructor so we can handle several assets size see the Resolution and Retina! part. The Phaser.Game object doesn't offer this kind of functionality, so how could we handle multiple assets size without fighting on our side on different assets size / scale factor multiplication and so on... ?
The long story is on the forum.
Thanks.