aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/3ds/osystem-graphics.cpp
diff options
context:
space:
mode:
authorBastien Bouclet2019-11-07 11:02:00 +0100
committerBastien Bouclet2019-11-07 11:02:00 +0100
commit652722e760fab2959c74e2fa65452f334c8b8478 (patch)
tree5c03f9e31bcfe9d73292d66a2eaaaa3738e41de8 /backends/platform/3ds/osystem-graphics.cpp
parent6901ee0242c128d3b6026f83a10da4ca90e265e0 (diff)
downloadscummvm-rg350-652722e760fab2959c74e2fa65452f334c8b8478.tar.gz
scummvm-rg350-652722e760fab2959c74e2fa65452f334c8b8478.tar.bz2
scummvm-rg350-652722e760fab2959c74e2fa65452f334c8b8478.zip
3DS: Rework mouse cursor movement
- Fix clipping the cursor position - Ensure the mouse has the same vertical and horizontal speed
Diffstat (limited to 'backends/platform/3ds/osystem-graphics.cpp')
-rw-r--r--backends/platform/3ds/osystem-graphics.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/backends/platform/3ds/osystem-graphics.cpp b/backends/platform/3ds/osystem-graphics.cpp
index 8fb92f4d48..c3864c143f 100644
--- a/backends/platform/3ds/osystem-graphics.cpp
+++ b/backends/platform/3ds/osystem-graphics.cpp
@@ -233,6 +233,16 @@ OSystem::TransactionError OSystem_3DS::endGFXTransaction() {
return OSystem::kTransactionSuccess;
}
+float OSystem_3DS::getScaleRatio() const {
+ if (_overlayVisible) {
+ return 1.0;
+ } else if (config.screen == kScreenTop) {
+ return _gameTopTexture.getScaleX();
+ } else {
+ return _gameBottomTexture.getScaleX();
+ }
+}
+
void OSystem_3DS::setPalette(const byte *colors, uint start, uint num) {
assert(start + num <= 256);
memcpy(_palette + 3 * start, colors, 3 * num);
@@ -578,18 +588,17 @@ void OSystem_3DS::warpMouse(int x, int y) {
_cursorY = y;
// TODO: adjust for _cursorScalable ?
- int offsetx = 0;
- int offsety = 0;
x -= _cursorHotspotX;
y -= _cursorHotspotY;
+
+ int offsetx = 0;
+ int offsety = 0;
if (!_overlayVisible) {
- offsetx += config.screen == kScreenTop ? _gameTopX : _gameBottomX;
- offsety += config.screen == kScreenTop ? _gameTopY : _gameBottomY;
+ offsetx = config.screen == kScreenTop ? _gameTopTexture.getPosX() : _gameBottomTexture.getPosX();
+ offsety = config.screen == kScreenTop ? _gameTopTexture.getPosY() : _gameBottomTexture.getPosY();
}
- float scalex = config.screen == kScreenTop ? (float)_gameTopTexture.actualWidth / _gameWidth : 1.f;
- float scaley = config.screen == kScreenTop ? (float)_gameTopTexture.actualHeight / _gameHeight : 1.f;
- _cursorTexture.setPosition(scalex * x + offsetx,
- scaley * y + offsety);
+
+ _cursorTexture.setPosition(x + offsetx, y + offsety);
}
void OSystem_3DS::setCursorDelta(float deltaX, float deltaY) {