From 16edf8fb586cd1878532c495aca12bbf5d0a53df Mon Sep 17 00:00:00 2001 From: Scott Ludwig Date: Fri, 1 Jan 2016 12:03:03 -0800 Subject: [PATCH] handle display and input coordinate changes introduced by iOS 8 --- game/iphone/host.cpp | 8 +++++++- game/iphone/wiview.mm | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/game/iphone/host.cpp b/game/iphone/host.cpp index ab0c924..91b5bec 100644 --- a/game/iphone/host.cpp +++ b/game/iphone/host.cpp @@ -129,7 +129,7 @@ bool ProcessMessage(base::Message *pmsg, Event *pevt) case kidmMouseMove2: pevt->eType = penMoveEvent2; pevt->ff = kfEvtFinger; - break; + break; case kidmAppTerminate: pevt->eType = appStopEvent; @@ -181,9 +181,15 @@ bool ProcessMessage(base::Message *pmsg, Event *pevt) gpdisp->GetMode(&mode); switch (mode.nDegreeOrientation) { case 0: +#if 0 // iOS <= 7 // Screen rotated 90 degrees but coordinates unrotated pevt->x = pmsg->y; pevt->y = (cy - 1) - pmsg->x; +#else + // As of iOS 8 screen coordinates are interface oriented not device oriented. + pevt->x = pmsg->x; + pevt->y = pmsg->y; +#endif break; case 90: diff --git a/game/iphone/wiview.mm b/game/iphone/wiview.mm index 6ec093d..d0a4d7c 100644 --- a/game/iphone/wiview.mm +++ b/game/iphone/wiview.mm @@ -23,7 +23,12 @@ return nil; } +#if 0 // iOS <= 7 rect_ = CGRectMake(0, 0, rect.size.height, rect.size.width); +#else + // As of iOS 8 screen coordinates are interface oriented not device oriented. + rect_ = CGRectMake(0, 0, rect.size.width, rect.size.height); +#endif [self setMultipleTouchEnabled: YES]; atouch_[0] = NULL;