Change in FlxGame zoom functionality?

103 views
Skip to first unread message

Shakii

unread,
Jul 16, 2015, 2:36:57 AM7/16/15
to haxef...@googlegroups.com
Hello! I used to experiment with Flixel a couple years back, and am looking to get back into the swing of things.

I immediately bumped into something - The zoom parameter in the FlxGame constructor doesn't seem to do anything any more. I recall it being used to magnify the stage. For example, a zoom level of 2 would display each single pixel as four. It's how you'd get that low-res pixel look with your game.

To better see this in action, I set the scale mode to fixed to prevent the application scaling with the window, but now it seems like the zoom level is locked at 1. Shouldn't I be able to set the zoom in the FlxGame constructor to 2 or higher? Is there something I'm missing?

The documentation for this functionality doesn't look like it's changed: http://api.haxeflixel.com/flixel/FlxGame.html
 - "The default level of zoom for the game's cameras (e.g. 2 = all pixels are now drawn at 2x). Default = 1."

Jesse Abram

unread,
Jul 18, 2015, 6:27:17 PM7/18/15
to haxef...@googlegroups.com
I'm also having issues with this - No matter what I set the number to, it doesn't really zoom in.
Also, things like my FlxButtons start out way smaller than they used to.

SruloArt

unread,
Jul 19, 2015, 10:00:31 AM7/19/15
to haxef...@googlegroups.com
In order to get what you want you should override the scale mode. For example, see what happens if you set this:
FlxG.scaleMode = new StageSizeScaleMode();

Jesse Abram

unread,
Jul 19, 2015, 3:32:45 PM7/19/15
to haxef...@googlegroups.com
Thanks SruloArt,
It works!
I'm curious, though, why does the template for Main.hx give us a designated place to enter the scale mode if it's not functional until we enter the line you gave us?
Is it just something that became necessary after a version update but hasn't been updated in the template?
Cheers,
J

SruloArt

unread,
Jul 19, 2015, 3:53:31 PM7/19/15
to haxef...@googlegroups.com
It makes sense since the initial zoom is always a factor in several important places, e.g when you change the value in the Main.hx it affects the FlxCamera default zoom, but due to how several ScaleModes act you can't actually see the differences. Just experiment with the different ScaleModes (change the right side instance to a different ScaleMode) and try to understand why sometimes the zoom does make a difference, it's really easy to learn and override :)
Reply all
Reply to author
Forward
0 new messages