aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2009-10-31 12:17:38 +0000
committerFilippos Karapetis2009-10-31 12:17:38 +0000
commitcd3f9336abe5ac9c99c817bd4abcf37c8c940bde (patch)
tree6e3904de06d30ae47ce4492217139595db075a8d /engines/sci
parent71db8b851bf27bb4c76e5122161b3a0fe38c3ed3 (diff)
downloadscummvm-rg350-cd3f9336abe5ac9c99c817bd4abcf37c8c940bde.tar.gz
scummvm-rg350-cd3f9336abe5ac9c99c817bd4abcf37c8c940bde.tar.bz2
scummvm-rg350-cd3f9336abe5ac9c99c817bd4abcf37c8c940bde.zip
Cursor positioning now takes screen scaling into account
svn-id: r45556
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/gui/gui_cursor.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/engines/sci/gui/gui_cursor.cpp b/engines/sci/gui/gui_cursor.cpp
index db1ae1ca6d..e24e6e36b5 100644
--- a/engines/sci/gui/gui_cursor.cpp
+++ b/engines/sci/gui/gui_cursor.cpp
@@ -39,8 +39,8 @@ namespace Sci {
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::setView(GuiResourceId viewNum, int loopNum, int celNum, Commo
}
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 @@ void SciGuiCursor::refreshPosition() {
// FIXME: Do this only when mouse is grabbed?
if (clipped)
- g_system->warpMouse(mousePoint.x, mousePoint.y);
+ setPosition(mousePoint);
}
} // End of namespace Sci