mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-16 02:59:49 +01:00
Split the display layout config between landscape and portrait orientations
This commit is contained in:
1 parent
174d45279c
commit
4994246c8b
61 files changed
+482
-317
No files matched your search
@@ -16,17 +16,18 @@
|
||||
|
||||
static const bool ClickDebug = false;
|
||||
|
||||
UIScreen::UIScreen()
|
||||
: Screen() {
|
||||
lastPortrait_ = UsePortraitLayout();
|
||||
UIScreen::UIScreen() : Screen() {
|
||||
lastOrientation_ = GetDeviceOrientation();
|
||||
}
|
||||
|
||||
UIScreen::~UIScreen() {
|
||||
delete root_;
|
||||
}
|
||||
|
||||
bool UIScreen::UsePortraitLayout() const {
|
||||
return g_display.dp_yres > g_display.dp_xres * 1.1f;
|
||||
// This is the source of truth for orientation for configuration and rendering.
|
||||
DeviceOrientation UIScreen::GetDeviceOrientation() const {
|
||||
// TODO: On some platforms, we can do a more sophisticated check.
|
||||
return g_display.GetDeviceOrientation();
|
||||
}
|
||||
|
||||
void UIScreen::DoRecreateViews() {
|
||||
@@ -140,10 +141,10 @@ bool UIScreen::UnsyncKey(const KeyInput &key) {
|
||||
}
|
||||
|
||||
void UIScreen::update() {
|
||||
bool portrait = UsePortraitLayout();
|
||||
if (portrait != lastPortrait_) {
|
||||
DeviceOrientation orientation = GetDeviceOrientation();
|
||||
if (orientation != lastOrientation_) {
|
||||
RecreateViews();
|
||||
lastPortrait_ = portrait;
|
||||
lastOrientation_ = orientation;
|
||||
}
|
||||
|
||||
DoRecreateViews();
|
||||
|
||||
Reference in new issue
Block a user