[rcore] add GetDisplayWidth() and GetDisplayHeight() #5188
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As far as I know, the way you're supposed to find out how big you can make your window/get the display resolution is GetMonitorWidth(GetCurrentMonitor())
works great, so why even add this?
because that doesn't work on android
monitor stuff isn't implemented yet for android, and even if it was, thinking of monitors in android applications doesn't really feel right anyway
so I started thinking of the best way to expose ANativeWindow_getWidth() to the user in some way, since to me it seems like what you'd want for android
one option was to make GetMonitorWidth() on android a fake that always just returns ANativeWindow_getWidth(), but that didn't seem right
while looking for solutions I found a response to an issue by raysan which mentioned that InitWindow(0, 0) automatically creates a window with the display size as the window size
and turns out on android the display size is set with ANativeWindow_getWidth()/Height()
it's as far as I know the only way to access the value from within the library
so I thought: display size seems really useful and would solve my problem, why not expose it?
it even seems like an easier alternative than the working monitor based desktop solution
if there is a good reason display width and height currently aren't exposed, no problem, of course, I am really just looking for any way to expose ANativeWindow_getWidth(), and this seemed like one that would at the same time make the api easier for all other platforms as well