Whats the best way to integrate the starling builder way of scaling with the starling scaffold scaling as with 1x/2x viewport, for loaded textures, or should i just use the starling builder StageUtil function and drop the 1x factor all together.Code examples would be awesome, and thanks guys!
How To Use Starling Builder With Starling Scaffold for scaling(5 posts) (2 voices)
For scaling, you can just take the code from the demo project to the scaffold project:
There should be no difference between 1x and 2x viewport.
When you load your assets, you can simply do
if (Starling.current.nativeStage.stageWidth > SOME_VALUE) load2xAssets(); else load1xAssets();
When you load your 2x textures, make sure to set scaleFactor to 2 in order to make them the same size as the 1x textures
Thanks for the comment, but this is more of a starling builder engine api, that uses the starling framework for launching.
with starling builder engine the code is
var stageUtil:StageUtil = new StageUtil(stage); var size:Point = stageUtil.getScaledStageSize(stage.stageWidth, stage.stageHeight); _starling.viewPort = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight); _starling.stage.stageWidth = size.x; _starling.stage.stageHeight = size.y; _starling.start();
versus starling framework code of
var stageSize:Rectangle = new Rectangle(0, 0, StageWidth, StageHeight); var screenSize:Rectangle = new Rectangle(0, 0, stage.fullScreenWidth, stage.fullScreenHeight); var viewPort:Rectangle = RectangleUtil.fit(stageSize, screenSize, ScaleMode.SHOW_ALL); var scaleFactor:int = viewPort.width < 480 ? 1 : 2; _starling = new Starling(Root, stage, viewPort, null, "auto", "auto"); _starling.stage.stageWidth = StageWidth; _starling.stage.stageHeight = StageHeight;
the difference being the scaling technique between the two but a am not sure of the best way to use both for different screen res.
I think you can just pick the one works better for you:)
One thing I like about the starling builder approach is it gracefully supports device with any resolution without a special case.
I have been talking to Daniel lately and we agreed to improve it on the next Starling release. Let's hope for the best!
Thanks again for the response, and that's what i was thinking also, but if u guys determine differently please update me.. and thanks again.
You must log in to post.