Game scale

149 views
Skip to first unread message

Uldis Baurovskis

unread,
Nov 14, 2015, 4:08:36 PM11/14/15
to haxef...@googlegroups.com
Hi.
During my Starling game port to HaxeFlixel, I got stuck on how to scale my game for multi resolution. (I know this theme is asked a lot :) so sorry in advance).

In Starling I used viewport and stage scale to achieve fullscreen mode. 

My base size for my game is (480x320).

I have texture atlases 1x,1.5x, 2x,2.5x,3x,3.5x,4x. (based on scale)

So ,for example, for iPad 2 (1024x768) I used viewport of (1024x768) but stage size of(512x384) with scale 2.
After that I load texture atlas of scale factor and positioned elements relative to stage size. (So all my elements have the same screen size on all resolutions).

I tried similar approach in HaxeFlixel. I set swf size in xml to 1024x768. After calculating stage size and scale, I tried to set size of FlxGame to 512x384 and zoom to 2, and loaded texture atlas 2x. 
Size of objects where correct and they where positioned correctly ,but images where not sharp and looked jugged. I even tried to load 4x resolution texture but it looked the same just bigger in size.

I played with scale modes but without success. 

I am doing scaling right or there is better way to achieve multi resolution in HaxeFlixel?

I test in flash target. And use HaxeFlixel form haxe lib.

Thanks in advance.

Uldis Baurovskis

unread,
Nov 14, 2015, 4:30:17 PM11/14/15
to HaxeFlixel
As usual , after some minutes found similar post :D

https://groups.google.com/forum/#!topic/haxeflixel/xRC6ztr8T1w

Uldis Baurovskis

unread,
Nov 23, 2015, 2:06:17 AM11/23/15
to HaxeFlixel
Any ideas here? Because I am completely stuck. As for iOS/Android support I need some strategy how to organize multi screen support.

Dlean Jeans

unread,
Nov 23, 2015, 2:21:47 AM11/23/15
to HaxeFlixel
To remove the "not sharp and jugged" image, try setting the gameWidth and gameHeight in Main.hx 1.5 times the size in the Project.xml file like this:
var gameWidth:Int = Std.int(Lib.current.stage.stageWidth * 1.5);
var gameHeight:Int = Std.int(Lib.current.stage.stageHeight * 1.5);

Also enable anti-aliasing in each state by adding like this in create():

override public function create():Void {
FlxG.camera.antialiasing = true;

// your code here
}
Message has been deleted

Tembac

unread,
Nov 30, 2015, 8:31:25 PM11/30/15
to HaxeFlixel
I made a similar research two year ago. I don't have a good answer yet but I made a test:

https://github.com/Tembac/DensitiesTest

Uldis Baurovskis

unread,
Dec 7, 2015, 5:01:07 PM12/7/15
to HaxeFlixel
Thanks for example. At the end I used similar method. I calculated scale based on my min size and set game size to real size of screen and loaded assets based on scale value.
Reply all
Reply to author
Forward
0 new messages