subsoap / defos

Extra native OS functions for games written using the Defold game engine
Creative Commons Zero v1.0 Universal
112 stars 16 forks source link

Get native resolution for display #88

Closed rgrams closed 5 years ago

rgrams commented 5 years ago

I would like to be able to get a list of all the resolutions that a display supports. Hopefully this would support multiple monitors, you would pass in an index for which display you want to check.

dapetcu21 commented 5 years ago

What would be the use case of this? You can always get the size of the window when the window is full screen. You'll also be able to get it if we implement #87.

I would be against setting the screen resolution, though. On macOS, at least, that's bad practice. This was a useful practice on CRT screens, but on LCD, your pixels are scaled anyway.

From Apple's documentation: Avoid changing the display resolution from that chosen by the user. If your application needs to render data at a lower resolution for performance reasons, you can explicitly create a back buffer at the desired resolution and allow OpenGL to scale those results to the display. See Controlling the Back Buffer Size.

On macOS this has other implications like having to capture the display and not allowing the user to do basic things like Cmd+Tab away or change their media volume. I've seen way too many games get this wrong...

rgrams commented 5 years ago

Hmm, that's a good point. Perhaps I am outdated in my thinking. I certainly agree that changing the display resolution is bad. And changing the game's resolution would be done on the game side of things (render target and whatnot). If you can get the full size of the display with #87, that would be fine.