diff options
author | Johannes Schickel | 2012-02-20 17:35:19 +0100 |
---|---|---|
committer | Johannes Schickel | 2012-02-20 18:39:57 +0100 |
commit | d4c167414d13bab393f95ec430d717a0413a1b82 (patch) | |
tree | 4fa1933985ae951329532ca43ed244d724c6ee8d /backends/platform/iphone/osys_events.cpp | |
parent | 5cc3d754f72c640f905b535f662b742c8b3794dc (diff) | |
download | scummvm-rg350-d4c167414d13bab393f95ec430d717a0413a1b82.tar.gz scummvm-rg350-d4c167414d13bab393f95ec430d717a0413a1b82.tar.bz2 scummvm-rg350-d4c167414d13bab393f95ec430d717a0413a1b82.zip |
IPHONE: Refactor event code a bit.
Now mouse x/y coordinates are passed as int.
Diffstat (limited to 'backends/platform/iphone/osys_events.cpp')
-rw-r--r-- | backends/platform/iphone/osys_events.cpp | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/backends/platform/iphone/osys_events.cpp b/backends/platform/iphone/osys_events.cpp index 5beba8a397..c167da35e6 100644 --- a/backends/platform/iphone/osys_events.cpp +++ b/backends/platform/iphone/osys_events.cpp @@ -47,41 +47,9 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { } int eventType; - float xUnit, yUnit; - - if (iPhone_fetchEvent(&eventType, &xUnit, &yUnit)) { - int x = 0; - int y = 0; - switch (_screenOrientation) { - case kScreenOrientationPortrait: - if (_overlayVisible) { - x = (int)(xUnit * _overlayWidth); - y = (int)(yUnit * _overlayHeight); - } else { - x = (int)(xUnit * _screenWidth); - y = (int)(yUnit * _screenHeight); - } - break; - case kScreenOrientationLandscape: - if (_overlayVisible) { - x = (int)(yUnit * _overlayWidth); - y = (int)((1.0 - xUnit) * _overlayHeight); - } else { - x = (int)(yUnit * _screenWidth); - y = (int)((1.0 - xUnit) * _screenHeight); - } - break; - case kScreenOrientationFlippedLandscape: - if (_overlayVisible) { - x = (int)((1.0 - yUnit) * _overlayWidth); - y = (int)(xUnit * _overlayHeight); - } else { - x = (int)((1.0 - yUnit) * _screenWidth); - y = (int)(xUnit * _screenHeight); - } - break; - } + int x, y; + if (iPhone_fetchEvent(&eventType, &x, &y)) { switch ((InputEvent)eventType) { case kInputMouseDown: if (!handleEvent_mouseDown(event, x, y)) @@ -112,7 +80,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { return false; break; case kInputOrientationChanged: - handleEvent_orientationChanged((int)xUnit); + handleEvent_orientationChanged(x); return false; break; @@ -122,11 +90,11 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { break; case kInputKeyPressed: - handleEvent_keyPressed(event, (int)xUnit); + handleEvent_keyPressed(event, x); break; case kInputSwipe: - if (!handleEvent_swipe(event, (int)xUnit)) + if (!handleEvent_swipe(event, x)) return false; break; |