[Scummvm-cvs-logs] SF.net SVN: scummvm:[45556] scummvm/trunk/engines/sci/gui/gui_cursor.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat Oct 31 13:17:39 CET 2009


Revision: 45556
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45556&view=rev
Author:   thebluegr
Date:     2009-10-31 12:17:38 +0000 (Sat, 31 Oct 2009)

Log Message:
-----------
Cursor positioning now takes screen scaling into account

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gui/gui_cursor.cpp

Modified: scummvm/trunk/engines/sci/gui/gui_cursor.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_cursor.cpp	2009-10-31 10:54:19 UTC (rev 45555)
+++ scummvm/trunk/engines/sci/gui/gui_cursor.cpp	2009-10-31 12:17:38 UTC (rev 45556)
@@ -39,8 +39,8 @@
 SciGuiCursor::SciGuiCursor(ResourceManager *resMan, SciGuiPalette *palette, SciGuiScreen *screen)
 	: _resMan(resMan), _palette(palette), _screen(screen) {
 
-	setPosition(Common::Point(160, 150));		// TODO: how is that different in 640x400 games?
-	setMoveZone(Common::Rect(0, 0, 320, 200));	// TODO: hires games
+	setPosition(Common::Point(160, 150));
+	setMoveZone(Common::Rect(0, 0, _screen->_displayWidth, _screen->_displayHeight));
 }
 
 SciGuiCursor::~SciGuiCursor() {
@@ -157,11 +157,24 @@
 }
 
 void SciGuiCursor::setPosition(Common::Point pos) {
-	g_system->warpMouse(pos.x, pos.y);
+	int scaleFactor = _screen->getScaleFactor();
+
+	if (scaleFactor == 1)
+		g_system->warpMouse(pos.x, pos.y);
+	else
+		g_system->warpMouse(pos.x * scaleFactor, pos.y * scaleFactor);
 }
 
 Common::Point SciGuiCursor::getPosition() {
-	return g_system->getEventManager()->getMousePos();
+	int scaleFactor = _screen->getScaleFactor();
+	Common::Point pos = g_system->getEventManager()->getMousePos();
+
+	if (scaleFactor != 1) {
+		pos.x /= scaleFactor;
+		pos.y /= scaleFactor;
+	}
+
+	return pos;
 }
 
 void SciGuiCursor::refreshPosition() {
@@ -186,7 +199,7 @@
 
 	// FIXME: Do this only when mouse is grabbed?
 	if (clipped)
-		g_system->warpMouse(mousePoint.x, mousePoint.y);
+		setPosition(mousePoint);
 }
 
 } // End of namespace Sci


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list