Problem with window size dpi scaling?

when i say window width in project xml openfl,
window size does not scale, i have high dpi computer but window size does not scale with openfl, it should scale from pixel size specified in window in xml, any fix ?

have seen on openfl 3 with haxdflixel, and openfl 4 with piratepig sample

help, thank much !

Here is probably the easiest way. If you’re interested in finer control, try my layout library.

not what i meant,

on openfl on surface pro 4, window size is tiny, does not scale! 400px should scale based on system DPi! openfl not doing? way to enable? resolution is big, if app not scale, too small to click

Under the hood, we use a library called SDL2 to handle windows and the OpenGL context. It supports “HIGH_DPI” but only on macOS, I believe – Linux and Windows might not be supported (I haven’t tested Linux, and I know that the Windows output is not “DPI aware”)

The flag is called SDL_WINDOW_ALLOW_HIGHDPI, and does not work on Windows, to my knowledge. You can enable using <window allow-high-dpi="true" /> in your project.xml

is there plans to fix sdl2 work with hidpi on linux and windos ? i have test windows but it not dpi aware, scaling is wrong
please consider fix, many display now hidpi

I’m not sure if we can fix it in SDL2 (it seems like a larger, more complicated issue), but we may be able to do GPU scaling to preserve the original intended scale, in cases where you request a specific window width and height. Would this help?

if i understand you saying
you say if app request window size 800x600, actual window size may not be 800x600, depending on dpi, if you see kha haxe framework it scale correct, app window size should scale according to dpi, otherwise window too small on hidpi, actual pixel size need be independent detach from adjusted pixel size, openfl window should convert, most windows apps already do

thank very much for help! i appreciate much!

It looks like Kha uses custom C++ code for different targets. They are using distinct Microsoft APIs when targeting Windows, which probably has helped them support high density display support

I just asked on the SDL mailing list what the current status is for Windows on SDL2, so perhaps we’ll hear back soon :slight_smile:

1 Like

thanks you very much sir! please tell me when you get inform ,!