Difference in rendering between html5 & mac native with update


I am on Mac OSX 10.10.5, and I just updated to the latest version of lime and openfl. I had a project I was literally working on prior to updating, and now when I run it my graphics, which was full screen moments ago now occupy the upper-left fourth of my window. Its worth noting that I am using drawTiles for my rendering.

Surprisingly I do not have this scaling issue when testing on html5.

I have ran ‘openfl upgrade’, as well as ‘openfl clean mac -64’ prior to testing.

Any help is greatly appreciated!

edit: It looks like my stageWidth and stageHeight are double what is specified in my project.xml, which would explain the graphics being reduced to a fourth. Is there any way to correctly adjust this?

edit: I’ve verified that using openfl 3.3.9 displays the graphics correctly.

Do you have a retina screen?

It should be using this now, but perhaps we could (should?) make it an option whether to allow high DPI graphics or not

1 Like

I do have a retina display. Is there anything in my configuration that I need to specify, or is this the sort of thing where my applicaiton needs to check for the display and then scale accordingly?

Or are retina displays not supported by openfl currently?

No, I think the issue is that actually OpenFL is handling retina graphics now, so it will be 2x the original dimensions due to pixel density. If you handle stage RESIZE events you should be able to render to the proper size, I believe. I don’t have a retina Mac, though, so I have not tested fullscreen, though I hear things work properly right now windowed. Have you tried windowed? Is that exhibiting the same (or different) behavior?

1 Like

So in 3.3.9 windowed mode works how I expect it to (stage fills the window) but not in fullscreen. In 3.4.0 this is not the case for either windowed or fullscreen.

Does resize get fired upon frame enter? I don’t seem to be able to automatically resize it - but if I manually call a method setting the scale that works fine.

Is that what you meant by handling resize events? Essentially checking the stageWidth and stageHeight vs. the expected value, and then setting the scales accordingly?

Is there an easy way to grab the window width and height from the project.xml?

Thank you!

Basically that.

I’d suggest this:

<set name="windowWidth" value="800" />
<set name="windowHeight" value="600" />

<window width="${windowWidth}" height="${windowHeight}" unless="mobile" />
<haxedef name="windowWidth" value="${windowWidth}" />
<haxedef name="windowHeight" value="${windowHeight}" />

Once you do that, you can do this:

import haxe.macro.Compiler;
var nominalWidth:Int = Compiler.getDefine("windowWidth");
var nominalHeight:Int = Compiler.getDefine("windowHeight");
1 Like

Cool, thank you! I appreciate the responses!