FNA-XNA / FNA

FNA - Accuracy-focused XNA4 reimplementation for open platforms
https://fna-xna.github.io/
2.65k stars 272 forks source link

FNA: Add last possible orientation value PORTRAIT_FLIPPED #471

Closed jfmu closed 10 months ago

jfmu commented 10 months ago

… or PortraitUpsideDown. This really crashes on tablets otherwise. Corresponding pull request is in FNA3D, though the DisplayOrientation enum there is not used at all yet. https://github.com/FNA-XNA/FNA3D/pull/190

flibitijibibo commented 10 months ago

I think this has to be marked as an extension first, but this might be for @TheSpydog, since I thought this was either documented or translated properly for iOS.

flibitijibibo commented 10 months ago

Are we able to add a case to this and treat it as Portrait?

https://github.com/FNA-XNA/FNA/blob/master/src/FNAPlatform/SDL2_FNAPlatform.cs#L863

jaedan commented 10 months ago

By "tablet", I can clarify this was an x86-64 MSFT surface tablet running windows. I think that counts as "desktop".

TheSpydog commented 10 months ago

Thanks for the PR / report!

I don't think this is the right solution, because the actual issue is more sinister: Windows builds have no business handling display orientation logic in the first place. The fact that any of this is happening in the first place is a bug. The only platforms that should care about orientation are iOS and Android. We're missing some logic to prevent other platforms from reacting to these orientation events.

However, even if we fixed that bug, this crash will still happen on iPad if UIInterfaceOrientationPortraitUpsideDown is listed as a supported orientation in the Info.plist. So we should address that as well, probably via flibit's proposed solution above.

TheSpydog commented 10 months ago

However, even if we fixed that bug, this crash will still happen on iPad if UIInterfaceOrientationPortraitUpsideDown is listed as a supported orientation in the Info.plist. So we should address that as well, probably via flibit's proposed solution above.

Confirmed that this proposed fix works on iPad, so that change should definitely be made.

flibitijibibo commented 10 months ago

Let's go ahead and add that line in then - will push it some time tomorrow if nobody beats me to this.

Thanks for catching this!

jfmu commented 10 months ago

Cool..thanks :-)

flibitijibibo commented 10 months ago

https://github.com/FNA-XNA/FNA/commit/303edb551565619f8100ad9b71fa7719b1a093f6