aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/iphone/osys_events.cpp
diff options
context:
space:
mode:
authorOystein Eftevaag2010-09-29 00:19:13 +0000
committerOystein Eftevaag2010-09-29 00:19:13 +0000
commitab01f42a4bf33192c43bdae49ddfa9040d013c68 (patch)
treeadf5a27e2824e3448ee7409491e6f8cada699f1c /backends/platform/iphone/osys_events.cpp
parenta0c0b934c75bc93f467b9b30f765e31aaf1a1536 (diff)
downloadscummvm-rg350-ab01f42a4bf33192c43bdae49ddfa9040d013c68.tar.gz
scummvm-rg350-ab01f42a4bf33192c43bdae49ddfa9040d013c68.tar.bz2
scummvm-rg350-ab01f42a4bf33192c43bdae49ddfa9040d013c68.zip
IPHONE: The overlay will now always be in the native device resolution
svn-id: r52939
Diffstat (limited to 'backends/platform/iphone/osys_events.cpp')
-rw-r--r--backends/platform/iphone/osys_events.cpp38
1 files changed, 28 insertions, 10 deletions
diff --git a/backends/platform/iphone/osys_events.cpp b/backends/platform/iphone/osys_events.cpp
index c1c7ffdc0c..f1e3b9ba62 100644
--- a/backends/platform/iphone/osys_events.cpp
+++ b/backends/platform/iphone/osys_events.cpp
@@ -60,16 +60,31 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {
int y = 0;
switch (_screenOrientation) {
case kScreenOrientationPortrait:
- x = (int)(xUnit * _screenWidth);
- y = (int)(yUnit * _screenHeight);
+ if (_overlayVisible) {
+ x = (int)(xUnit * _overlayWidth);
+ y = (int)(yUnit * _overlayHeight);
+ } else {
+ x = (int)(xUnit * _screenWidth);
+ y = (int)(yUnit * _screenHeight);
+ }
break;
case kScreenOrientationLandscape:
- x = (int)(yUnit * _screenWidth);
- y = (int)((1.0 - xUnit) * _screenHeight);
+ 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:
- x = (int)((1.0 - yUnit) * _screenWidth);
- y = (int)(xUnit * _screenHeight);
+ if (_overlayVisible) {
+ x = (int)((1.0 - yUnit) * _overlayWidth);
+ y = (int)(xUnit * _overlayHeight);
+ } else {
+ x = (int)((1.0 - yUnit) * _screenWidth);
+ y = (int)(xUnit * _screenHeight);
+ }
break;
}
@@ -262,15 +277,18 @@ bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y
mouseNewPosX = (int)(_mouseX - deltaX / 0.5f);
mouseNewPosY = (int)(_mouseY - deltaY / 0.5f);
+ int widthCap = _overlayVisible ? _overlayWidth : _screenWidth;
+ int heightCap = _overlayVisible ? _overlayHeight : _screenHeight;
+
if (mouseNewPosX < 0)
mouseNewPosX = 0;
- else if (mouseNewPosX > _screenWidth)
- mouseNewPosX = _screenWidth;
+ else if (mouseNewPosX > widthCap)
+ mouseNewPosX = widthCap;
if (mouseNewPosY < 0)
mouseNewPosY = 0;
- else if (mouseNewPosY > _screenHeight)
- mouseNewPosY = _screenHeight;
+ else if (mouseNewPosY > heightCap)
+ mouseNewPosY = heightCap;
} else {
mouseNewPosX = x;