aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/3ds
diff options
context:
space:
mode:
authorMichael Ball2019-11-28 12:17:42 -0800
committerBastien Bouclet2019-11-30 18:53:23 +0100
commit6f678e6e84ae1a21c825fde582a956ac189cec3f (patch)
treeca43f9252677c100b74a806a135e3466e9412d6f /backends/platform/3ds
parent2048c9cc7810948f6dc913dd44e606efcab9bb2b (diff)
downloadscummvm-rg350-6f678e6e84ae1a21c825fde582a956ac189cec3f.tar.gz
scummvm-rg350-6f678e6e84ae1a21c825fde582a956ac189cec3f.tar.bz2
scummvm-rg350-6f678e6e84ae1a21c825fde582a956ac189cec3f.zip
3DS: Prevent magnify effect from updating while the GUI is active
Diffstat (limited to 'backends/platform/3ds')
-rw-r--r--backends/platform/3ds/osystem-events.cpp1
-rw-r--r--backends/platform/3ds/osystem-graphics.cpp24
-rw-r--r--backends/platform/3ds/osystem.cpp8
-rw-r--r--backends/platform/3ds/osystem.h8
4 files changed, 24 insertions, 17 deletions
diff --git a/backends/platform/3ds/osystem-events.cpp b/backends/platform/3ds/osystem-events.cpp
index 1ee550ed66..6af7c4dd52 100644
--- a/backends/platform/3ds/osystem-events.cpp
+++ b/backends/platform/3ds/osystem-events.cpp
@@ -144,7 +144,6 @@ static void eventThreadFunc(void *arg) {
// Button events
if (keysPressed & KEY_L) {
if (g_gui.isActive()) {
- // TODO: Prevent the magnify effect from updating while the GUI is active
osys->displayMessageOnOSD(_("Magnify Mode cannot be activated in menus."));
} else if (config.screen != kScreenBoth && osys->getMagnifyMode() == MODE_MAGOFF) {
// TODO: Automatically enable both screens while magnify mode is on
diff --git a/backends/platform/3ds/osystem-graphics.cpp b/backends/platform/3ds/osystem-graphics.cpp
index fa419f28ec..e1170a96d5 100644
--- a/backends/platform/3ds/osystem-graphics.cpp
+++ b/backends/platform/3ds/osystem-graphics.cpp
@@ -25,6 +25,7 @@
#include "backends/platform/3ds/shader_shbin.h"
#include "common/rect.h"
#include "graphics/fontman.h"
+#include "gui/gui-manager.h"
#include "options-dialog.h"
#include "config.h"
@@ -156,8 +157,8 @@ void OSystem_3DS::initSize(uint width, uint height,
_gameHeight = height;
_gameTopTexture.create(width, height, _pfGameTexture);
_overlay.create(400, 320, _pfGameTexture);
- _topHalfWidth = _topWidth / 2;
- _topHalfHeight = _topHeight / 2;
+ _magCenterX = _magWidth / 2;
+ _magCenterY = _magHeight / 2;
if (format) {
debug("pixelformat: %d %d %d %d %d", format->bytesPerPixel, format->rBits(), format->gBits(), format->bBits(), format->aBits());
@@ -461,16 +462,21 @@ void OSystem_3DS::updateMagnify() {
_magnifyMode = MODE_MAGOFF;
}
+ // TODO: When exiting GUI, prevent cursor's position within GUI from changing
+ // position of magnification viewport. Possible solution: save in-game cursor
+ // coordinates separately from GUI cursor coordinates?
if (_magnifyMode == MODE_MAGON) {
- _topX = (_cursorX < _topHalfWidth) ?
- 0 : ((_cursorX < (_gameWidth - _topHalfWidth)) ?
- _cursorX - _topHalfWidth : _gameWidth - _topWidth);
- _topY = (_cursorY < _topHalfHeight) ?
- 0 : ((_cursorY < _gameHeight - _topHalfHeight) ?
- _cursorY - _topHalfHeight : _gameHeight - _topHeight);
+ if (!g_gui.isActive()) {
+ _magX = (_cursorX < _magCenterX) ?
+ 0 : ((_cursorX < (_gameWidth - _magCenterX)) ?
+ _cursorX - _magCenterX : _gameWidth - _magWidth);
+ _magY = (_cursorY < _magCenterY) ?
+ 0 : ((_cursorY < _gameHeight - _magCenterY) ?
+ _cursorY - _magCenterY : _gameHeight - _magHeight);
+ }
_gameTopTexture.setScale(1.f,1.f);
_gameTopTexture.setPosition(0,0);
- _gameTopTexture.setOffset(_topX, _topY);
+ _gameTopTexture.setOffset(_magX, _magY);
}
}
diff --git a/backends/platform/3ds/osystem.cpp b/backends/platform/3ds/osystem.cpp
index 2003795077..7ac115b8ce 100644
--- a/backends/platform/3ds/osystem.cpp
+++ b/backends/platform/3ds/osystem.cpp
@@ -72,10 +72,10 @@ OSystem_3DS::OSystem_3DS():
_gameBottomY(0),
_gameWidth(320),
_gameHeight(240),
- _topX(0),
- _topY(0),
- _topWidth(400),
- _topHeight(240),
+ _magX(0),
+ _magY(0),
+ _magWidth(400),
+ _magHeight(240),
_overlayVisible(false),
_screenChangeId(0),
_magnifyMode(MODE_MAGOFF),
diff --git a/backends/platform/3ds/osystem.h b/backends/platform/3ds/osystem.h
index a0f78fdce2..d6d667dc91 100644
--- a/backends/platform/3ds/osystem.h
+++ b/backends/platform/3ds/osystem.h
@@ -174,9 +174,6 @@ private:
u16 _gameWidth, _gameHeight;
u16 _gameTopX, _gameTopY;
u16 _gameBottomX, _gameBottomY;
- u16 _topWidth, _topHeight;
- u16 _topHalfWidth, _topHalfHeight;
- u16 _topX, _topY;
// Audio
Thread audioThread;
@@ -241,7 +238,12 @@ private:
float _cursorDeltaX, _cursorDeltaY;
int _cursorHotspotX, _cursorHotspotY;
uint32 _cursorKeyColor;
+
+ // Magnify
MagnifyMode _magnifyMode;
+ u16 _magX, _magY;
+ u16 _magWidth, _magHeight;
+ u16 _magCenterX, _magCenterY;
};
} // namespace _3DS