I would like to set my OpenFL application’s initial window size dynamically, for example by reading the size at startup from a user defined configuration file. In the OpenFL project XML file one can set the initial window size, but this is of course a compile time constant.
I tried calling Lib.application.window.resize(width, height) at the beginning of my main method, but this gets called only after the window is already on screen, resulting in an ugly “jump” from the original size to the resized one.
I then tried setting the window hidden=“true” attribute in the project XML, and this seems to work. The window is not visible when the main method is called, but it still exists in Lib.application.window and I was able to call its resize-method.
The problem is, I can’t get the initially hidden window to show up. I’ve tried setting its minimized property as false and I’ve called its focus-method. I even tried to reset the displayMode-property, although this required bypassing the private DisplayMode constructor. Nothing helps, the window is there, but won’t show up. I’ve read https://api.lime.software/lime/ui/Window.html and can’t figure out what other method or property I could use to make the window visible.
I’m testing this on Linux with Neko, using OpenFL 9.1.0 with Lime 7.9.0 and Haxe 4.2.2.