Wednesday, November 30, 2016

ViewPort problem with Starling

Following a tutorial with Starling, I fell in a little problem with the viewPort properties, where initial coordinates were wrong respectively with the top left corner of the screen. No matter which device I choose, Android or iOS (even in physical devices, not only in an emulator), the content still went bad, just like the image below:


To fix this issue, I just added width and height properties at the SWF directive in the main file:

[SWF(frameRate="60", backgroundColor="#000", width="480", height="800")]
public class Starling_walking_guy extends Sprite

That's all. the viewPort was fixed and the content now is centered.

UPDATE: So, it was necessary to add the two first lines in the Class constructor, I mean, Starling_walking_guy class:

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;

No comments:

Post a Comment