Friday, June 13, 2014

Weird Fullscreen Behaviour in OpenFL + HaxeFlixel

In OpenFL projects, the initial fullscreen status of the application can be specified in the project's application.xml file via the fullscreen boolean attribute of the window tag, as given in the specification.

However, I found that this attribute interacts in strange ways with HaxeFlixel's own fullscreen setting when building for desktop profiles (using OpenFL 1.4.0 and HaxeFlixel 3.2.2). Setting fullscreen to true results in the application having a window resolution that is not the one specified. In addition, the application drops out of fullscreen mode if FlxG.fullscreen is false.

On a side note, the fullscreen attribute behaves well in the mobile profile.

My solution to that is to set fullscreen to false in desktop builds, and rely on the functionality provided through HaxeFlixel's FlxG.fullscreen and the StartFullscreen parameter of FlxGame's constructor.