Open MCRusher opened 1 year ago
Nimx has a notion of Window.pixelRatio
, please have a look at sdl_window
to see how it is used. On most platforms it comes from screenScaleFactor()
, which unfortunately is not implemented on windows, so you might want to look into that.
And then I reread your comment and understand that you meant something else entirely :)
Yes, getDisplayBounds()
could be quite useful in nimx/screen.nim
.
I could make a PR if you want, to add it to nimx/screen.nim
, unless you'd rather/are planning to do it and would rather do it a different way
or if you want to make changes, like changing the error handling to throw an exception rather than call quit or something
Right now I'm on my linux laptop trying to bang out a linux X11 version and then I should have the three main desktop bases covered for this.
The x11 one seems to be working now, so I edited the code above to add it
I like to scale my windows based on the monitor resolution, which most gui libraries have a mechanism to allow.
But I haven't been able to find a way to get this info in nimx without manually stepping into SDL2 or winapi
I have both an SDL2 implementation as well as a winapi implementation I've written for nimx for my application to allow this, I haven't written a linux or macos version since I can't test them currently (and I'd never be able to test a mac version, I don't own a mac)
It'd be nice to have this functionality in nimx itself, and if you find my code useful and not broken code that just happens to work, feel free to use it.
If it's acceptable (which I doubt since you might not want it calling quit), I'd be willing to make a PR myself if you'd like, though I'm not sure where best to put it, maybe in the
nimx/private/windows/XX_window.nim
files?