thewierdnut / endless-mobile

Space exploration, trading, and combat game.
https://endless-sky.github.io/
GNU General Public License v3.0
116 stars 8 forks source link

Starting in reverse landscape glitches input location #119

Closed asl97 closed 1 year ago

asl97 commented 1 year ago

Is there an existing issue for this?

Describe the bug

When starting the game in reverse landscape, input is offset by a bit

Steps to Reproduce

  1. Start app with phone in portrait, note which direction the app open
  2. fully close the app, ensure "Lock Orientation/rotation" is selected
  3. Reopen the app with the phone in the other direction (reverse landscape)
  4. See the black bar on the camera side and top of screen
  5. Notice input is slightly off

note: it seem to fix itself after opening the recent menu and reentering the game

There also issue with reproducibility(?), to force it to appear, try opening the app in the 'correct' orientation and force closing before opening it in 'reverse' orientation, repeat a few times?

Expected Behavior

The app open properly with no black bar like when opening while the phone is in portrait or the correct landscape and input not offset

Screenshots

https://github.com/thewierdnut/endless-mobile/assets/4752645/1f6759b2-7c89-4497-b0d2-aaba7985f27b

Link to save file

No response

Device type

POCO F3

Game Version

0.10.4.39

Additional Information

No response

thewierdnut commented 1 year ago

This is AWESOME!

I've seen this bug on occasion, but I've been avoiding fixing it because I've never found a way to reliably reproduce it. The steps you outline work great!

MonkeyMatrix commented 1 year ago

I have also seen this before, but I was also unable to reproduce it. Thank you!

thewierdnut commented 1 year ago

Stupid SDL_StupidEventFilter flushes the stupid event queue, wiping out the stupid screen resize events. Stupid. Stupid Stupid.

Moved the Event filter prior to the event queue being initialized, which seems to fix it.