Resizing the game
Is there any way to resize the game on the fly? Like, change the values of GameHeight and GameWidth we are passing to the FlxGame constructor?
Documentation for FlgX.width and FlxG.height says "Read-only, use resizeGame() to change", but resizeGame() doesn't affect these values.
Seems that someone had the same problem more than a year ago.
So, after some messing around with this:
Resolution of my game, defined when creating the FlxGame, is 240x160, and it's displayed in 720x480 window (so scale x3)
Now, I need one of the states to have 720x480 resolution, so scale x1. When I put this in the Create()
It does completely nothing. But after doing this:
FlxG.resizeGame(720, 480); FlxG.camera.setScale(1, 1);
The game's resolution changes to 720x480, but everything is moved by 240x160px to bottom right.
(the white background thingie coordinates are 0x0)
I'm prolly doing something terribly wrong and/or silly.
Dunno if this works but try this after resizing your game
@DleanJeans Thank you, this helped. Kinda.
Right now, I'm ignoring resizeGame() completely, as it doesn't seem to do anything at all. I'm just messing with the camera, so:
flixel.FlxCamera.defaultZoom = 1; FlxG.cameras.reset(); FlxG.camera.setSize(720, 480);
is doing the job pretty well. Messy, but it works.
TIL that the solution I use (resizing anr rezooming the camera) doesn't work on mobile (at least on Android). It's not a necessity for me, as I need this only on flash target, just learned this by accident. :)