I am unable to figure out how to scale properly for Android devices (and possibly iOS, as I don’t have one to test). In my project.xml, I have the default settings for the Android screen size:
<window if="mobile" orientation="portrait" fullscreen="true" width="0" height="0" />
However, the issue is that I want to work with a 640 x 960 resolution in mind, and I want it to be scaled to that. And when I run it with this setting, it looks so much smaller than it does on desktop when I test it. So I instead tried to set it to this:
<window if="mobile" orientation="portrait" fullscreen="true" width="640" height="960" />
The issue then becomes a horizontal letterbox scaling style with black bars on the top and bottom, which is quite unattractive. I read on the forums that this is due to the on screen bottom navbar that some Androids have (mine included). And I read something about handling event.RESIZE events, which I do not understand how to work with. I would like to just develop for the 640 x 960.
Just to be clear, I am a rookie HaxeFlixel developer (clearly), but I am experienced in making apps, and I come from Corona SDK. I LOVE Haxe, and would really like to work with HaxeFlixel. And perhaps the issue is that I’m operating with Corona SDK’s scaling in mind. If you’re not familiar with the way Corona SDK works, the simple version is this: You develop with a certain screen size in mind, and often get black bars on the sides, which you can then fill in. This would be exactly what I’m comfortable with, and that is what it seems RatioScaleMode(true) is for. That way I can artificially fill in the missing spaces with filler, but it only works when the letterbox is vertical and has the black bars on the sides.
I have a test PlayState that I’m working with to learn that I will attach below. Thank you for any help!
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.util.FlxColor;
import flixel.text.FlxText;
import flixel.system.scaleModes.FillScaleMode;
class PlayState extends FlxState
{
var rect:FlxSprite;
var header:FlxSprite;
var headerText:FlxText;
override public function create():Void
{
super.create();
#if desktop
FlxG.mouse.useSystemCursor = true;
#end
FlxG.scaleMode = new FillScaleMode();
// Create a background
this.rect = new FlxSprite();
this.rect.makeGraphic(FlxG.width * 2, FlxG.height * 2, 0xFFFFFFFF);
this.add(rect);
// Create a header bar
this.header = new FlxSprite();
this.header.makeGraphic(FlxG.width, 100, 0xFF314970);
this.add(header);
// Create the header text
this.headerText = new FlxText(0, 5, FlxG.width);
this.headerText.text = "Testing!";
this.headerText.setFormat("assets/fonts/PassionOne-Regular.ttf", 70, 0xFFFFFFFF, FlxTextAlign.CENTER, FlxTextBorderStyle.NONE, 0xFF000000);
this.headerText.setBorderStyle(FlxTextBorderStyle.SHADOW, FlxColor.BLACK, 2);
this.add(headerText);
}
override public function update(elapsed:Float):Void
{
super.update(elapsed);
}
}