From ab15435ad0aac842ab8321b833cae4e7459df01d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 23 Feb 2012 02:08:12 +0100 Subject: [PATCH] IPHONE: Move overlay visibility status to VideoContext. --- backends/platform/iphone/iphone_common.h | 3 ++- backends/platform/iphone/iphone_video.mm | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/backends/platform/iphone/iphone_common.h b/backends/platform/iphone/iphone_common.h index 044b2793865..2696888f875 100644 --- a/backends/platform/iphone/iphone_common.h +++ b/backends/platform/iphone/iphone_common.h @@ -60,6 +60,7 @@ struct VideoContext { int screenWidth, screenHeight; // Overlay state + bool overlayVisible; int overlayWidth, overlayHeight; // Mouse cursor state @@ -85,7 +86,7 @@ const char *iPhone_getDocumentsDir(); bool iPhone_isHighResDevice(); int iPhone_getScreenHeight(); int iPhone_getScreenWidth(); -void iPhone_enableOverlay(int state); +void iPhone_enableOverlay(bool state); void iPhone_showCursor(int state); void iPhone_setMouseCursor(unsigned short *buffer, int width, int height, int hotspotX, int hotspotY); diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm index e4616914540..a4de9704207 100644 --- a/backends/platform/iphone/iphone_video.mm +++ b/backends/platform/iphone/iphone_video.mm @@ -37,7 +37,6 @@ static int _overlayTexHeight = 0; static CGRect _overlayRect; static int _needsScreenUpdate = 0; -static int _overlayIsEnabled = 0; static UITouch *_firstTouch = NULL; static UITouch *_secondTouch = NULL; @@ -93,8 +92,8 @@ void iPhone_setMouseCursor(unsigned short *buffer, int width, int height, int ho [sharedInstance performSelectorOnMainThread:@selector(updateMouseCursor) withObject:nil waitUntilDone: YES]; } -void iPhone_enableOverlay(int state) { - _overlayIsEnabled = state; +void iPhone_enableOverlay(bool state) { + _videoContext.overlayVisible = state; [sharedInstance performSelectorOnMainThread:@selector(clearColorBuffer) withObject:nil waitUntilDone: YES]; } @@ -272,6 +271,7 @@ const char *iPhone_getDocumentsDir() { _mouseCursorTexture = 0; _videoContext.graphicsMode = kGraphicsModeLinear; + _videoContext.overlayVisible = false; _gameScreenVertCoords[0] = _gameScreenVertCoords[1] = _gameScreenVertCoords[2] = _gameScreenVertCoords[3] = @@ -363,7 +363,7 @@ const char *iPhone_getDocumentsDir() { [self updateMainSurface]; - if (_overlayIsEnabled) + if (_videoContext.overlayVisible) [self updateOverlaySurface]; if (_videoContext.mouseIsVisible) @@ -422,7 +422,7 @@ const char *iPhone_getDocumentsDir() { CGRect *rect; int maxWidth, maxHeight; - if (!_overlayIsEnabled) { + if (!_videoContext.overlayVisible) { rect = &_gameScreenRect; maxWidth = _videoContext.screenWidth; maxHeight = _videoContext.screenHeight; @@ -695,7 +695,7 @@ const char *iPhone_getDocumentsDir() { CGRect *area; int width, height, offsetY; - if (_overlayIsEnabled) { + if (_videoContext.overlayVisible) { area = &_overlayRect; width = _videoContext.overlayWidth; height = _videoContext.overlayHeight;