[rcore_android] Allow setting window size on Android.#5810
Open
StupidRepo wants to merge 1 commit intoraysan5:masterfrom
Open
[rcore_android] Allow setting window size on Android.#5810StupidRepo wants to merge 1 commit intoraysan5:masterfrom
StupidRepo wants to merge 1 commit intoraysan5:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
My situation
APP_CMD_CONFIG_CHANGED.Why not just add this in
AndroidCommandCallback'sAPP_CMD_CONFIG_CHANGEDcase?Android does not send the correct width and height in time, therefore leading to you having to manually switch the height and width. This is fine, until you notice that Android has a somewhat-common chance to send the correct width and height and then everything gets stretched because you swapped the width to be the height to account for the wrong timing.
You could make a variable to mark the window as dirty then in a place that is triggered every frame, if that variable is true and the Android-reported size != current window size, set the variable to false and then update to the new size.
The solution for devs using raylib
SetWindowSizeto be usable, via this patch, on android.SetWindowSize(int width, int height).Additional comments
Let me know if this is okay - personally I wouldn't accept this PR as I'm sure there is a solution that allows putting this code in
APP_CMD_CONFIG_CHANGEDwhile receiving correct sizes from Android (see my 'Why not ...' above for why we can't do this already).This also is a better solution as it also correctly sets the size when INIT_WINDOW happens. So, if the app is in landscape and the users turns off the phone screen then turns it back on with the orientation in portrait, then that is also handled as the size change is detected.
Demos
Fix from this PR:
fixed.by.this.pr.mp4
Default behaviour:
app.stretch.mp4