From 5a3aa7a994b772c8f084350f6f80d38a3ae4ddaa Mon Sep 17 00:00:00 2001 From: Oystein Eftevaag Date: Sun, 15 May 2011 21:43:27 -0400 Subject: IPHONE: Fixed mouse position when the overlay is visible --- backends/platform/iphone/iphone_video.m | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'backends') diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m index 09832c783e..006603df64 100644 --- a/backends/platform/iphone/iphone_video.m +++ b/backends/platform/iphone/iphone_video.m @@ -175,13 +175,18 @@ const char* iPhone_getDocumentsDir() { } bool getLocalMouseCoords(CGPoint *point) { - if (point->x < _screenRect.origin.x || point->x >= _screenRect.origin.x + _screenRect.size.width || - point->y < _screenRect.origin.y || point->y >= _screenRect.origin.y + _screenRect.size.height) { - return false; - } + if (_overlayIsEnabled) { + point->x = point->x / _overlayHeight; + point->y = point->y / _overlayWidth; + } else { + if (point->x < _screenRect.origin.x || point->x >= _screenRect.origin.x + _screenRect.size.width || + point->y < _screenRect.origin.y || point->y >= _screenRect.origin.y + _screenRect.size.height) { + return false; + } - point->x = (point->x - _screenRect.origin.x) / _screenRect.size.width; - point->y = (point->y - _screenRect.origin.y) / _screenRect.size.height; + point->x = (point->x - _screenRect.origin.x) / _screenRect.size.width; + point->y = (point->y - _screenRect.origin.y) / _screenRect.size.height; + } return true; } -- cgit v1.2.3