Skip to content
Permalink
Browse files

3DS: Some changes to magnify mode

(cherry picked from commit 886be51)
  • Loading branch information...
bgK committed Nov 5, 2019
1 parent 3ea3687 commit cbfec1156e37975c494d6a9400f91f07cc26cbf2
@@ -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) {
@@ -274,20 +274,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();
}
@@ -428,6 +418,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();
@@ -146,6 +146,7 @@ class OSystem_3DS : public EventsBaseBackend, public PaletteManager {
void setCursorDelta(float deltaX, float deltaY);

void updateFocus();
void updateMagnify();
void updateConfig();
void updateSize();
void setMagnifyMode(MagnifyMode mode);

0 comments on commit cbfec11

Please sign in to comment.
You can’t perform that action at this time.