aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorBastien Bouclet2019-11-05 06:09:04 +0100
committerBastien Bouclet2019-11-05 06:09:04 +0100
commit886be5178e5a6281792cf94e21b716f6fa5a0606 (patch)
treeb95594422d2f768cd17232b6e80d12c678e79e10 /backends/platform
parent78de5724047f56bd3ecbfb9ab423bb6c943f6589 (diff)
downloadscummvm-rg350-886be5178e5a6281792cf94e21b716f6fa5a0606.tar.gz
scummvm-rg350-886be5178e5a6281792cf94e21b716f6fa5a0606.tar.bz2
scummvm-rg350-886be5178e5a6281792cf94e21b716f6fa5a0606.zip
3DS: Some changes to magnify mode
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/3ds/osystem-events.cpp22
-rw-r--r--backends/platform/3ds/osystem-graphics.cpp31
-rw-r--r--backends/platform/3ds/osystem.h1
3 files changed, 35 insertions, 19 deletions
diff --git a/backends/platform/3ds/osystem-events.cpp b/backends/platform/3ds/osystem-events.cpp
index 0e635f0e1f..c2239f4645 100644
--- a/backends/platform/3ds/osystem-events.cpp
+++ b/backends/platform/3ds/osystem-events.cpp
@@ -24,6 +24,7 @@
#include "osystem.h"
#include "backends/timer/default/default-timer.h"
+#include "gui/gui-manager.h"
#include "engines/engine.h"
#include "gui.h"
#include "options-dialog.h"
@@ -148,28 +149,33 @@ static void eventThreadFunc(void *arg) {
// Button events
if (keysPressed & KEY_L) {
- if (osys->getWidth() >= 400 || osys->getHeight() >= 240) {
+ 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
+ osys->displayMessageOnOSD("Magnify Mode can only be activated\n when both screens are enabled.");
+ } else if (osys->getWidth() <= 400 && osys->getHeight() <= 240) {
+ osys->displayMessageOnOSD("In-game resolution too small to magnify.");
+ } else {
if (osys->getMagnifyMode() == MODE_MAGOFF) {
osys->setMagnifyMode(MODE_MAGON);
if (inputMode == MODE_DRAG) {
inputMode = MODE_HOVER;
osys->displayMessageOnOSD("Magnify Mode On. Switching to Hover Mode...");
- } else
+ } else {
osys->displayMessageOnOSD("Magnify Mode On");
+ }
} else {
osys->setMagnifyMode(MODE_MAGOFF);
osys->updateSize();
if (savedInputMode == MODE_DRAG) {
inputMode = savedInputMode;
osys->displayMessageOnOSD("Magnify Mode Off. Reactivating Drag Mode...");
- } else
+ } else {
osys->displayMessageOnOSD("Magnify Mode Off");
+ }
}
- } else {
- if (osys->getWidth() == 0 || osys->getHeight() == 0) {
- osys->displayMessageOnOSD("Magnify Mode cannot be activated in Launcher.");
- } else
- osys->displayMessageOnOSD("In-game resolution too small to magnify.");
}
}
if (keysPressed & KEY_R) {
diff --git a/backends/platform/3ds/osystem-graphics.cpp b/backends/platform/3ds/osystem-graphics.cpp
index 7204a9fb05..8d4047b6ed 100644
--- a/backends/platform/3ds/osystem-graphics.cpp
+++ b/backends/platform/3ds/osystem-graphics.cpp
@@ -276,20 +276,10 @@ void OSystem_3DS::updateScreen() {
return;
// updateFocus();
+ updateMagnify();
C3D_FrameBegin(0);
_gameTopTexture.transfer();
- 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);
- _gameTopTexture.setScale(1.f,1.f);
- _gameTopTexture.setPosition(0,0);
- _gameTopTexture.setOffset(_topX, _topY);
- }
if (_overlayVisible) {
_overlay.transfer();
}
@@ -430,6 +420,25 @@ void OSystem_3DS::updateFocus() {
}
}
+void OSystem_3DS::updateMagnify() {
+ if (_magnifyMode == MODE_MAGON && config.screen != kScreenBoth) {
+ // Only allow to magnify when both screens are enabled
+ _magnifyMode = MODE_MAGOFF;
+ }
+
+ 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);
+ _gameTopTexture.setScale(1.f,1.f);
+ _gameTopTexture.setPosition(0,0);
+ _gameTopTexture.setOffset(_topX, _topY);
+ }
+}
+
void OSystem_3DS::showOverlay() {
_overlayVisible = true;
updateSize();
diff --git a/backends/platform/3ds/osystem.h b/backends/platform/3ds/osystem.h
index 544c900102..a1c67826a1 100644
--- a/backends/platform/3ds/osystem.h
+++ b/backends/platform/3ds/osystem.h
@@ -146,6 +146,7 @@ public:
void setCursorDelta(float deltaX, float deltaY);
void updateFocus();
+ void updateMagnify();
void updateConfig();
void updateSize();
void setMagnifyMode(MagnifyMode mode);