I was using SDL_GetCurrentDisplayMode() to get fullscreen window resolution, but many modern Android devices have a display cutout for camera, so window resolution is not always screen resolution.
I tried SDL_GetWindowSize(), but it doesn’t always return correct value. I tested it on Genymotion Google Pixel 2 (1920x1080), and it returned 1794x1017 on a few first frames, then correct 1920x1080. Currently I call SDL_GetWindowSize() 1 second after launch, but it slows down app startup. Is there a better way to do it?
Do you respond to resize events?
Thanks for response!
I don’t handle such events, and I think there is no sense in it because on Android window resolution doesn’t really change. I am looking for the way of getting fullscreen window size on the start of app.
However, note that in Android the window size may change when rotating the screen, and some devices may have multi window functionality. Handling resize events could ensure the correct size at all times.
Absolutely, in my app handling resize events is essential for that reason. If you lock the orientation to portrait or landscape then it may not be, but I don’t want to do that. You also get a resize event if you enable or disable Fullscreen mode with
My app is locked on landscape mode, so window size never changes.
Anyway, it’s a strange behaviour that SDL initially returns wrong window size and then changes it.
As I said, it could still change if you switch between Fullscreen and non-Fullscreen (which in the case of Android means covering the Status bar and Navigation bar, or not).