Resize window programmatically during run-time/start-up

327 views
Skip to first unread message

Zuriki

unread,
Jan 30, 2016, 6:34:13 AM1/30/16
to HaxeFlixel


Is it possible to resize the window? I've looked everywhere and I can't find anything of use.

FlxG.resizeGame(); only resizes the stage within the window.

I don't want to necessarily go fullscreen.

I don't even really need to resize the window whilst the game is running, only set the resolution of the window on start-up.

I know that you can set the windows size in the XML file, this is not what I want to do.

I tried calling Lib.application.window.resize(); but it just throws an error no matter where I use it (and all related Lib classes like openfl, flash, openfl._legacy, etc).

If there is really know way to do this then I would be utterly shocked. It's like, the most basic of engine features and it's missing?!

Gama11

unread,
Jan 30, 2016, 9:13:52 AM1/30/16
to HaxeFlixel
FlxG.stage.resize(width, height); should do this on native OpenFL legacy builds.

Zuriki

unread,
Jan 30, 2016, 9:49:10 AM1/30/16
to haxef...@googlegroups.com
Why was this information so hard to find?!

I don't understand why FlxG.resizeGame() doesn't do this?!

Gama11

unread,
Jan 30, 2016, 10:14:08 AM1/30/16
to HaxeFlixel
Well, it has a different functionality - it's resizeGame(), not resizeWindow(). You might want to have a game that only occupies part of the surrounding window.

Zuriki

unread,
Jan 30, 2016, 10:27:08 AM1/30/16
to HaxeFlixel
Even so, the stage != the window. That's why the stage has a scale mode, the stage scales to... the window.

Gama11

unread,
Jan 30, 2016, 10:28:28 AM1/30/16
to HaxeFlixel
I guess. Stage#resize() is OpenFL API though.

Gama11

unread,
Feb 1, 2016, 4:42:06 PM2/1/16
to HaxeFlixel
This improves the situation a bit. :)
Reply all
Reply to author
Forward
0 new messages