Question about Aspect Ratio, Scale modes and resolution.

69 views
Skip to first unread message

Esteban Dal Monte Roquero

unread,
May 5, 2016, 12:06:29 PM5/5/16
to HaxeFlixel
Hi fellow haxeflixers! 

I've been working on a mobile game for some time now. The game's resolution is 1280x720 so it's 16:9.
Also I've always used the default Scale mode (RatioScaleMode), so the game zooms but I get black bars on 4:3 devices or so , like the ipad.

The thing is I don't realize yet how to add images on the top and bottom to fill those bars. I asume that my game is centered at (0,0) so I add extra images of 120 pixels of height lets say at (0, -121) and another one at (0,721).

If I'm not mistaken, now I have an image that could fit in a 1280x960 resolution. The thing is from there I can't find a scale mode or modify one that works maintaining the ratio and the original 1280x720 image and letting those bars at the top and bottom render if they need to.

I tried this solution but the stage ends up being cut or misaligned. 

I'm setting a resolution of 1280x720 in my main and letting 0,0 in the xml.

Should I use the camera's "setBounds" or "setPosition" to some value?, I'm not setting that at all in my State. 
Should I align the stage some way?

class BaseScaleMode
{
public var deviceSize(default, null):FlxPoint;
public var gameSize(default, null):FlxPoint;
public var scale(default, null):FlxPoint;
public var offset(default, null):FlxPoint;
public var horizontalAlign(default, set):FlxHorizontalAlign = CENTER;
public var verticalAlign(default, set):FlxVerticalAlign = CENTER;
What is Offset , and what are the aligns for?

Thanks!

Esteban Dal Monte Roquero

unread,
May 5, 2016, 9:59:59 PM5/5/16
to HaxeFlixel
Hi, I just updated my code. Made my game render a bigger resolution and added some image on the top and bottom. 

Then set my camera bounds to  fit the new size.

Finally used RatioScaleMode with fillScreen, so the game cuts out the remaining in the top and bottom in the wide screens. 
Reply all
Reply to author
Forward
0 new messages