mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-31 19:47:06 +01:00
Display layout: No editing while the TV shows a layout for another orientation
With the game on a TV (landscape) and the device in portrait, the display layout screen edited the portrait layout, which the TV doesn't use, so nothing seemed to change. Its controls are now disabled in that case, and work as before with the device held the same way as the TV. The screen rotation hotkeys change the layout the game is shown with, the TV's, instead. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
b642984755
commit
080470d041
3 files changed
+51
-6
No files matched your search
@@ -38,6 +38,7 @@
|
||||
#include "Common/Data/Color/RGBAUtil.h"
|
||||
#include "Common/Data/Text/I18n.h"
|
||||
#include "UI/DisplayLayoutScreen.h"
|
||||
#include "UI/EmuScreen.h"
|
||||
#include "UI/Background.h"
|
||||
#include "UI/MiscViews.h"
|
||||
#include "Core/Config.h"
|
||||
@@ -200,6 +201,21 @@ void DisplayLayoutScreen::sendMessage(UIMessage message, const char *value) {
|
||||
}
|
||||
}
|
||||
|
||||
// Disables every control in the group, except keep.
|
||||
static void DisableControls(UI::ViewGroup *group, const UI::View *keep) {
|
||||
for (int i = 0; i < group->GetNumSubviews(); i++) {
|
||||
UI::View *view = group->GetViewByIndex(i);
|
||||
if (view == keep) {
|
||||
continue;
|
||||
}
|
||||
if (view->IsViewGroup()) {
|
||||
DisableControls((UI::ViewGroup *)view, keep);
|
||||
} else {
|
||||
view->SetEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayLayoutScreen::CreateViews() {
|
||||
const Bounds &bounds = screenManager()->getUIContext()->GetBounds();
|
||||
|
||||
@@ -568,6 +584,12 @@ void DisplayLayoutScreen::CreateViews() {
|
||||
}
|
||||
}
|
||||
|
||||
// With the game on a TV and the device held the other way, these would edit a layout that isn't shown.
|
||||
DeviceOrientation gameOrientation;
|
||||
if (GetGameOutputOrientation(screenManager(), &gameOrientation) && gameOrientation != GetDeviceOrientation()) {
|
||||
DisableControls(root_, back);
|
||||
}
|
||||
|
||||
root_->Add(new DisplayLayoutBackground(mode_, GetDeviceOrientation(), new AnchorLayoutParams(FILL_PARENT, FILL_PARENT, 0.0f, 0.0f, 0.0f, 0.0f)));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user