From 021b124b737e1acd9005d568885578809b4fc077 Mon Sep 17 00:00:00 2001 From: Dave Nicolson Date: Sun, 4 Sep 2022 16:18:17 +0200 Subject: [PATCH] Fix touch events in portrait orientation --- wolf3d/code/iphone/EAGLView.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wolf3d/code/iphone/EAGLView.m b/wolf3d/code/iphone/EAGLView.m index 5674408..cf6eeeb 100644 --- a/wolf3d/code/iphone/EAGLView.m +++ b/wolf3d/code/iphone/EAGLView.m @@ -321,8 +321,9 @@ - (void) handleTouches:(NSSet*)touches withEvent:(UIEvent*)event { for (UITouch *myTouch in t) { CGPoint touchLocation = [myTouch locationInView:self]; - - if ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) { + + UIDeviceOrientation deviceOrientation = [[UIDevice currentDevice] orientation]; + if (deviceOrientation == UIDeviceOrientationLandscapeLeft || deviceOrientation == UIDeviceOrientationPortrait) { points[ 2 * touchCount + 1 ] = self.bounds.size.width - (self.bounds.size.width - touchLocation.x); points[ 2 * touchCount + 0 ] = self.bounds.size.height - touchLocation.y; } else {