[Scummvm-cvs-logs] scummvm master -> 93d80793b459d6567fdd9717e02a3473e5f4fcec

lordhoto lordhoto at gmail.com
Mon Feb 20 00:31:56 CET 2012


This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ceae3dd191 IPHONE: Rename _palette to _gamePalette.
87d85a7b20 IPHONE: Use the proper RGBA5551 palette for the mouse cursor.
68bbe973bd IPHONE: Always use the mouse texture.
438bc50115 IPHONE: Fix cursor hotspots.
93d80793b4 IPHONE: Implement cursor visibility change again.


Commit: ceae3dd191039711ea388e2878397d26a0932611
    https://github.com/scummvm/scummvm/commit/ceae3dd191039711ea388e2878397d26a0932611
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-19T13:16:38-08:00

Commit Message:
IPHONE: Rename _palette to _gamePalette.

Changed paths:
    backends/platform/iphone/osys_main.h
    backends/platform/iphone/osys_video.cpp



diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index 993c1aa..b89eed9 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -70,7 +70,7 @@ protected:
 
 	uint16 *_fullscreen;
 
-	uint16  _palette[256];
+	uint16  _gamePalette[256];
 	bool _overlayVisible;
 	uint16 _screenWidth;
 	uint16 _screenHeight;
diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp
index 8aabe4e..c97b675 100644
--- a/backends/platform/iphone/osys_video.cpp
+++ b/backends/platform/iphone/osys_video.cpp
@@ -98,7 +98,7 @@ void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) {
 	const byte *b = colors;
 
 	for (uint i = start; i < start + num; ++i) {
-		_palette[i] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(b[0], b[1], b[2]);
+		_gamePalette[i] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(b[0], b[1], b[2]);
 		b += 3;
 	}
 
@@ -110,7 +110,7 @@ void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) {
 	byte *b = colors;
 
 	for (uint i = start; i < start + num; ++i) {
-		Graphics::colorToRGB<Graphics::ColorMasks<565> >(_palette[i], b[0], b[1], b[2]);
+		Graphics::colorToRGB<Graphics::ColorMasks<565> >(_gamePalette[i], b[0], b[1], b[2]);
 		b += 3;
 	}
 }
@@ -256,7 +256,7 @@ void OSystem_IPHONE::drawDirtyRect(const Common::Rect &dirtyRect) {
 	uint16 *dst = &_fullscreen[dirtyRect.top * _screenWidth + dirtyRect.left];
 	for (int y = h; y > 0; y--) {
 		for (int x = w; x > 0; x--)
-			*dst++ = _palette[*src++];
+			*dst++ = _gamePalette[*src++];
 
 		dst += _screenWidth - w;
 		src += _screenWidth - w;
@@ -310,7 +310,7 @@ void OSystem_IPHONE::drawMouseCursorOnRectUpdate(const Common::Rect &updatedRect
 		for (int y = displayHeight; y > srcY; y--) {
 			for (int x = displayWidth; x > srcX; x--) {
 				if (*src != _mouseKeyColor)
-					*dst = _palette[*src];
+					*dst = _gamePalette[*src];
 				dst++;
 				src++;
 			}
@@ -473,7 +473,7 @@ void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspot
 		for (uint y = 0; y < h; ++y) {
 			byte color = buf[y * w + x];
 			if (color != keycolor)
-				mouseBuf[y * texWidth + x] = _palette[color] | 0x1;
+				mouseBuf[y * texWidth + x] = _gamePalette[color] | 0x1;
 			else
 				mouseBuf[y * texWidth + x] = 0x0;
 		}


Commit: 87d85a7b20c611898bbb4c714b40de5691a8d8ff
    https://github.com/scummvm/scummvm/commit/87d85a7b20c611898bbb4c714b40de5691a8d8ff
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-19T13:19:38-08:00

Commit Message:
IPHONE: Use the proper RGBA5551 palette for the mouse cursor.

Formerly the overlay cursor was using a RGB565 palette, even though the
texture is really set up as RGBA5551.

Changed paths:
    backends/platform/iphone/osys_main.h
    backends/platform/iphone/osys_video.cpp



diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index b89eed9..c63ba41 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -70,7 +70,10 @@ protected:
 
 	uint16 *_fullscreen;
 
+	// For use with the game texture
 	uint16  _gamePalette[256];
+	// For use with the mouse texture
+	uint16  _gamePaletteRGBA5551[256];
 	bool _overlayVisible;
 	uint16 _screenWidth;
 	uint16 _screenHeight;
diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp
index c97b675..3b14126 100644
--- a/backends/platform/iphone/osys_video.cpp
+++ b/backends/platform/iphone/osys_video.cpp
@@ -99,6 +99,7 @@ void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) {
 
 	for (uint i = start; i < start + num; ++i) {
 		_gamePalette[i] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(b[0], b[1], b[2]);
+		_gamePaletteRGBA5551[i] = Graphics::RGBToColor<Graphics::ColorMasks<5551> >(b[0], b[1], b[2]);
 		b += 3;
 	}
 
@@ -473,7 +474,7 @@ void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspot
 		for (uint y = 0; y < h; ++y) {
 			byte color = buf[y * w + x];
 			if (color != keycolor)
-				mouseBuf[y * texWidth + x] = _gamePalette[color] | 0x1;
+				mouseBuf[y * texWidth + x] = _gamePaletteRGBA5551[color] | 0x1;
 			else
 				mouseBuf[y * texWidth + x] = 0x0;
 		}


Commit: 68bbe973bdbf0a455fc416f2c533092d920f5ac7
    https://github.com/scummvm/scummvm/commit/68bbe973bdbf0a455fc416f2c533092d920f5ac7
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-19T15:08:42-08:00

Commit Message:
IPHONE: Always use the mouse texture.

Formerly the mouse texture was only used when the overlay was visible. When
only the game screen was visible, the code rendered the mouse cursor on the
game screen texture.

This simplifies the drawing pipeline a bit.

Changed paths:
    backends/platform/iphone/iphone_video.m
    backends/platform/iphone/osys_main.cpp
    backends/platform/iphone/osys_main.h
    backends/platform/iphone/osys_video.cpp



diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index 4ef43f2..df95b36 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -108,8 +108,8 @@ void iPhone_updateScreen(int mouseX, int mouseY) {
 	//_mouseX = _overlayHeight - mouseX;
 	//_mouseY = mouseY;
 
-	_mouseX = (_overlayWidth - mouseX) / (float)_overlayWidth * _overlayHeight;
-	_mouseY = mouseY / (float)_overlayHeight * _overlayWidth;
+	_mouseX = mouseX;
+	_mouseY = mouseY;
 
 	if (!_needsScreenUpdate) {
 		_needsScreenUpdate = 1;
@@ -259,16 +259,14 @@ bool getLocalMouseCoords(CGPoint *point) {
 	}
 	_needsScreenUpdate = 0;
 
-	if (_overlayIsEnabled) {
-		glClear(GL_COLOR_BUFFER_BIT); printOpenGLError();
-	}
+	glClear(GL_COLOR_BUFFER_BIT); printOpenGLError();
 
 	[self updateMainSurface];
 
-	if (_overlayIsEnabled) {
+	if (_overlayIsEnabled)
 		[self updateOverlaySurface];
-		[self updateMouseSurface];
-	}
+
+	[self updateMouseSurface];
 
 	glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
 	[_context presentRenderbuffer:GL_RENDERBUFFER_OES];
@@ -350,14 +348,32 @@ bool getLocalMouseCoords(CGPoint *point) {
 
 - (void)updateMouseSurface {
 
-	int width = _mouseCursorWidth / (float)_backingWidth * _backingHeight;
-	int height = _mouseCursorHeight / (float)_backingHeight * _backingWidth;
+	int width = _mouseCursorWidth;
+	int height = _mouseCursorHeight;
+
+	int mouseX = _mouseX;
+	int mouseY = _mouseY;
+
+	if (!_overlayIsEnabled) {
+		const GLint gameWidth = (_visibleHeight - 2 * _widthOffset);
+		const GLint gameHeight = (_visibleWidth - 2 * _heightOffset);
+
+		mouseX = (_width - mouseX) / (float)_width * gameHeight + _heightOffset;
+		mouseY = mouseY / (float)_height * gameWidth + _widthOffset;
+		width = width / (float)_width * gameHeight;
+		height = height / (float)_height * gameWidth;
+	} else {
+		mouseX = (_overlayWidth - mouseX) / (float)_overlayWidth * _backingWidth;
+		mouseY = mouseY / (float)_overlayHeight * _backingHeight;
+		width = width / (float)_overlayWidth * _backingWidth;
+		height = height / (float)_overlayHeight * _backingHeight;
+	}
 
 	GLfloat vertices[] = {
-		_mouseX, _mouseY,
-		_mouseX + height, _mouseY,
-		_mouseX, _mouseY + width,
-		_mouseX + height,  _mouseY + width
+		mouseX        , mouseY,
+		mouseX + width, mouseY,
+		mouseX        , mouseY + height,
+		mouseX + width, mouseY + height
 	};
 
 	//printf("Cursor: width %u height %u\n", _mouseCursorWidth, _mouseCursorHeight);
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index ba1604f..5cf8913 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -62,8 +62,6 @@ OSystem_IPHONE::OSystem_IPHONE() :
 	_mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0),
 	_overlayHeight(0), _overlayWidth(0), _overlayBuffer(0) {
 	_queuedInputEvent.type = Common::EVENT_INVALID;
-	_lastDrawnMouseRect = Common::Rect(0, 0, 0, 0);
-
 	_touchpadModeEnabled = !iPhone_isHighResDevice();
 	_fsFactory = new POSIXFilesystemFactory();
 }
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index c63ba41..dad2e9f 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -91,7 +91,6 @@ protected:
 	long _lastMouseDown;
 	long _lastMouseTap;
 	long _queuedEventTime;
-	Common::Rect _lastDrawnMouseRect;
 	Common::Event _queuedInputEvent;
 	bool _secondaryTapped;
 	long _lastSecondaryDown;
@@ -192,11 +191,9 @@ protected:
 	void internUpdateScreen();
 	void dirtyFullScreen();
 	void dirtyFullOverlayScreen();
-	void clipRectToScreen(int16 &x, int16 &y, int16 &w, int16 &h);
 	void suspendLoop();
 	void drawDirtyRect(const Common::Rect &dirtyRect);
 	void drawDirtyOverlayRect(const Common::Rect &dirtyRect);
-	void drawMouseCursorOnRectUpdate(const Common::Rect &updatedRect, const Common::Rect &mouseRect);
 	void updateHardwareSurfaceForRect(const Common::Rect &updatedRect);
 	static void AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB);
 	static int timerHandler(int t);
diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp
index 3b14126..ad43415 100644
--- a/backends/platform/iphone/osys_video.cpp
+++ b/backends/platform/iphone/osys_video.cpp
@@ -159,32 +159,6 @@ void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y,
 	}
 }
 
-void OSystem_IPHONE::clipRectToScreen(int16 &x, int16 &y, int16 &w, int16 &h) {
-	if (x < 0) {
-		w += x;
-		x = 0;
-	}
-
-	if (y < 0) {
-		h += y;
-		y = 0;
-	}
-
-	if (w > _screenWidth - x)
-		w = _screenWidth - x;
-
-	if (h > _screenHeight - y)
-		h = _screenHeight - y;
-
-	if (w < 0) {
-		w = 0;
-	}
-
-	if (h < 0) {
-		h = 0;
-	}
-}
-
 void OSystem_IPHONE::updateScreen() {
 	//printf("updateScreen(): %i dirty rects.\n", _dirtyRects.size());
 
@@ -192,6 +166,7 @@ void OSystem_IPHONE::updateScreen() {
 		return;
 
 	internUpdateScreen();
+	_mouseDirty = false;
 	_fullScreenIsDirty = false;
 	_fullScreenOverlayIsDirty = false;
 
@@ -199,40 +174,11 @@ void OSystem_IPHONE::updateScreen() {
 }
 
 void OSystem_IPHONE::internUpdateScreen() {
-	int16 mouseX = _mouseX - _mouseHotspotX;
-	int16 mouseY = _mouseY - _mouseHotspotY;
-	int16 mouseWidth = _mouseWidth;
-	int16 mouseHeight = _mouseHeight;
-
-	clipRectToScreen(mouseX, mouseY, mouseWidth, mouseHeight);
-
-	Common::Rect mouseRect(mouseX, mouseY, mouseX + mouseWidth, mouseY + mouseHeight);
-
-	if (_mouseDirty) {
-		if (!_fullScreenIsDirty) {
-			_dirtyRects.push_back(_lastDrawnMouseRect);
-			_dirtyRects.push_back(mouseRect);
-		}
-		if (!_fullScreenOverlayIsDirty && _overlayVisible) {
-			_dirtyOverlayRects.push_back(_lastDrawnMouseRect);
-			_dirtyOverlayRects.push_back(mouseRect);
-		}
-		_mouseDirty = false;
-		_lastDrawnMouseRect = mouseRect;
-	}
-
 	while (_dirtyRects.size()) {
 		Common::Rect dirtyRect = _dirtyRects.remove_at(_dirtyRects.size() - 1);
 
 		//printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
-
 		drawDirtyRect(dirtyRect);
-
-		if (_overlayVisible)
-			drawDirtyOverlayRect(dirtyRect);
-		else
-			drawMouseCursorOnRectUpdate(dirtyRect, mouseRect);
-
 		updateHardwareSurfaceForRect(dirtyRect);
 	}
 
@@ -241,10 +187,7 @@ void OSystem_IPHONE::internUpdateScreen() {
 			Common::Rect dirtyRect = _dirtyOverlayRects.remove_at(_dirtyOverlayRects.size() - 1);
 
 			//printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
-
 			drawDirtyOverlayRect(dirtyRect);
-			//drawMouseCursorOnRectUpdate(dirtyRect, mouseRect);
-			//updateHardwareSurfaceForRect(dirtyRect);
 		}
 	}
 }
@@ -278,49 +221,6 @@ void OSystem_IPHONE::drawDirtyOverlayRect(const Common::Rect &dirtyRect) {
 	iPhone_updateOverlayRect(_overlayBuffer, dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
 }
 
-void OSystem_IPHONE::drawMouseCursorOnRectUpdate(const Common::Rect &updatedRect, const Common::Rect &mouseRect) {
-	//draw mouse on top
-	if (_mouseVisible && (updatedRect.intersects(mouseRect))) {
-		int srcX = 0;
-		int srcY = 0;
-		int left = _mouseX - _mouseHotspotX;
-		if (left < 0) {
-			srcX -= left;
-			left = 0;
-		}
-		int top = _mouseY - _mouseHotspotY;
-		if (top < 0) {
-			srcY -= top;
-			top = 0;
-		}
-
-		int bottom = top + _mouseHeight;
-		if (bottom > _screenWidth)
-			bottom = _screenWidth;
-
-		int displayWidth = _mouseWidth;
-		if (_mouseWidth + left > _screenWidth)
-			displayWidth = _screenWidth - left;
-
-		int displayHeight = _mouseHeight;
-		if (_mouseHeight + top > _screenHeight)
-			displayHeight = _screenHeight - top;
-
-		byte *src = &_mouseBuf[srcY * _mouseWidth + srcX];
-		uint16 *dst = &_fullscreen[top * _screenWidth + left];
-		for (int y = displayHeight; y > srcY; y--) {
-			for (int x = displayWidth; x > srcX; x--) {
-				if (*src != _mouseKeyColor)
-					*dst = _gamePalette[*src];
-				dst++;
-				src++;
-			}
-			dst += _screenWidth - displayWidth + srcX;
-			src += _mouseWidth - displayWidth + srcX;
-		}
-	}
-}
-
 void OSystem_IPHONE::updateHardwareSurfaceForRect(const Common::Rect &updatedRect) {
 	iPhone_updateScreenRect(_fullscreen, updatedRect.left, updatedRect.top, updatedRect.right, updatedRect.bottom);
 }


Commit: 438bc50115b7d1faf62c5821514d9941792790d0
    https://github.com/scummvm/scummvm/commit/438bc50115b7d1faf62c5821514d9941792790d0
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-19T15:25:48-08:00

Commit Message:
IPHONE: Fix cursor hotspots.

Changed paths:
    backends/platform/iphone/iphone_common.h
    backends/platform/iphone/iphone_video.m
    backends/platform/iphone/osys_video.cpp



diff --git a/backends/platform/iphone/iphone_common.h b/backends/platform/iphone/iphone_common.h
index d6d3a3d..98d1244 100644
--- a/backends/platform/iphone/iphone_common.h
+++ b/backends/platform/iphone/iphone_common.h
@@ -75,7 +75,7 @@ bool iPhone_isHighResDevice();
 int iPhone_getScreenHeight();
 int iPhone_getScreenWidth();
 void iPhone_enableOverlay(int state);
-void iPhone_setMouseCursor(short *buffer, int width, int height);
+void iPhone_setMouseCursor(short *buffer, int width, int height, int hotspotX, int hotspotY);
 
 uint getSizeNextPOT(uint size);
 
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index df95b36..a412945 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -51,6 +51,8 @@ static UITouch *_secondTouch = NULL;
 static short *_mouseCursor = NULL;
 static int _mouseCursorHeight = 0;
 static int _mouseCursorWidth = 0;
+static int _mouseCursorHotspotX = 0;
+static int _mouseCursorHotspotY = 0;
 static int _mouseX = 0;
 static int _mouseY = 0;
 
@@ -72,12 +74,15 @@ int printOglError(const char *file, int line) {
 	return retCode;
 }
 
-void iPhone_setMouseCursor(short *buffer, int width, int height) {
+void iPhone_setMouseCursor(short *buffer, int width, int height, int hotspotX, int hotspotY) {
 	_mouseCursor = buffer;
 
 	_mouseCursorWidth = width;
 	_mouseCursorHeight = height;
 
+	_mouseCursorHotspotX = hotspotX;
+	_mouseCursorHotspotY = hotspotY;
+
 	[sharedInstance performSelectorOnMainThread:@selector(updateMouseCursor) withObject:nil waitUntilDone: YES];
 }
 
@@ -354,21 +359,31 @@ bool getLocalMouseCoords(CGPoint *point) {
 	int mouseX = _mouseX;
 	int mouseY = _mouseY;
 
+	int hotspotX = _mouseCursorHotspotX;
+	int hotspotY = _mouseCursorHotspotY;
+
 	if (!_overlayIsEnabled) {
 		const GLint gameWidth = (_visibleHeight - 2 * _widthOffset);
 		const GLint gameHeight = (_visibleWidth - 2 * _heightOffset);
 
 		mouseX = (_width - mouseX) / (float)_width * gameHeight + _heightOffset;
 		mouseY = mouseY / (float)_height * gameWidth + _widthOffset;
+		hotspotX = hotspotX / (float)_width * gameHeight;
+		hotspotY = hotspotY / (float)_height * gameWidth;
 		width = width / (float)_width * gameHeight;
 		height = height / (float)_height * gameWidth;
 	} else {
 		mouseX = (_overlayWidth - mouseX) / (float)_overlayWidth * _backingWidth;
 		mouseY = mouseY / (float)_overlayHeight * _backingHeight;
+		hotspotX = hotspotX / (float)_overlayWidth * _backingWidth;
+		hotspotY = hotspotY / (float)_overlayHeight * _backingHeight;
 		width = width / (float)_overlayWidth * _backingWidth;
 		height = height / (float)_overlayHeight * _backingHeight;
 	}
 
+	mouseX -= hotspotX;
+	mouseY -= hotspotY;
+
 	GLfloat vertices[] = {
 		mouseX        , mouseY,
 		mouseX + width, mouseY,
diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp
index ad43415..4d3d49c 100644
--- a/backends/platform/iphone/osys_video.cpp
+++ b/backends/platform/iphone/osys_video.cpp
@@ -170,7 +170,7 @@ void OSystem_IPHONE::updateScreen() {
 	_fullScreenIsDirty = false;
 	_fullScreenOverlayIsDirty = false;
 
-	iPhone_updateScreen(_mouseX - _mouseHotspotX, _mouseY - _mouseHotspotY);
+	iPhone_updateScreen(_mouseX, _mouseY);
 }
 
 void OSystem_IPHONE::internUpdateScreen() {
@@ -380,7 +380,7 @@ void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspot
 		}
 	}
 
-	iPhone_setMouseCursor(mouseBuf, w, h);
+	iPhone_setMouseCursor(mouseBuf, w, h, hotspotX, hotspotY);
 
 	if (_mouseBuf != NULL && (_mouseWidth != w || _mouseHeight != h)) {
 		free(_mouseBuf);


Commit: 93d80793b459d6567fdd9717e02a3473e5f4fcec
    https://github.com/scummvm/scummvm/commit/93d80793b459d6567fdd9717e02a3473e5f4fcec
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-19T15:29:08-08:00

Commit Message:
IPHONE: Implement cursor visibility change again.

Changed paths:
    backends/platform/iphone/iphone_common.h
    backends/platform/iphone/iphone_video.m
    backends/platform/iphone/osys_video.cpp



diff --git a/backends/platform/iphone/iphone_common.h b/backends/platform/iphone/iphone_common.h
index 98d1244..470c042 100644
--- a/backends/platform/iphone/iphone_common.h
+++ b/backends/platform/iphone/iphone_common.h
@@ -75,6 +75,7 @@ bool iPhone_isHighResDevice();
 int iPhone_getScreenHeight();
 int iPhone_getScreenWidth();
 void iPhone_enableOverlay(int state);
+void iPhone_showCursor(int state);
 void iPhone_setMouseCursor(short *buffer, int width, int height, int hotspotX, int hotspotY);
 
 uint getSizeNextPOT(uint size);
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index a412945..a18d68e 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -55,6 +55,7 @@ static int _mouseCursorHotspotX = 0;
 static int _mouseCursorHotspotY = 0;
 static int _mouseX = 0;
 static int _mouseY = 0;
+static int _mouseCursorEnabled = 0;
 
 // static long lastTick = 0;
 // static int frames = 0;
@@ -74,6 +75,10 @@ int printOglError(const char *file, int line) {
 	return retCode;
 }
 
+void iPhone_showCursor(int state) {
+	_mouseCursorEnabled = state;
+}
+
 void iPhone_setMouseCursor(short *buffer, int width, int height, int hotspotX, int hotspotY) {
 	_mouseCursor = buffer;
 
@@ -271,7 +276,8 @@ bool getLocalMouseCoords(CGPoint *point) {
 	if (_overlayIsEnabled)
 		[self updateOverlaySurface];
 
-	[self updateMouseSurface];
+	if (_mouseCursorEnabled)
+		[self updateMouseSurface];
 
 	glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
 	[_context presentRenderbuffer:GL_RENDERBUFFER_OES];
diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp
index 4d3d49c..2c9e563 100644
--- a/backends/platform/iphone/osys_video.cpp
+++ b/backends/platform/iphone/osys_video.cpp
@@ -332,6 +332,7 @@ int16 OSystem_IPHONE::getOverlayWidth() {
 bool OSystem_IPHONE::showMouse(bool visible) {
 	bool last = _mouseVisible;
 	_mouseVisible = visible;
+	iPhone_showCursor(visible);
 	_mouseDirty = true;
 
 	return last;






More information about the Scummvm-git-logs mailing list