mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Switch to vertical layout automatically as the window is being resized
Prevents ending up in the wrong layout on startup and being unable to fix it without restarting the emulator.
This commit is contained in:
parent
8a7573004d
commit
498136bbf8
@ -707,6 +707,7 @@ UI::EventReturn GameBrowser::NavigateClick(UI::EventParams &e) {
|
||||
MainScreen::MainScreen() : highlightProgress_(0.0f), prevHighlightProgress_(0.0f), backFromStore_(false), lockBackgroundAudio_(false) {
|
||||
System_SendMessage("event", "mainscreen");
|
||||
SetBackgroundAudioGame("");
|
||||
lastVertical_ = UseVerticalLayout();
|
||||
}
|
||||
|
||||
MainScreen::~MainScreen() {
|
||||
@ -721,7 +722,7 @@ void MainScreen::CreateViews() {
|
||||
using namespace UI;
|
||||
|
||||
// Vertical mode is not finished.
|
||||
bool vertical = dp_yres > dp_xres;
|
||||
bool vertical = UseVerticalLayout();
|
||||
|
||||
I18NCategory *m = GetI18NCategory("MainMenu");
|
||||
|
||||
@ -906,6 +907,15 @@ void MainScreen::sendMessage(const char *message, const char *value) {
|
||||
void MainScreen::update(InputState &input) {
|
||||
UIScreen::update(input);
|
||||
UpdateUIState(UISTATE_MENU);
|
||||
bool vertical = UseVerticalLayout();
|
||||
if (vertical != lastVertical_) {
|
||||
RecreateViews();
|
||||
lastVertical_ = vertical;
|
||||
}
|
||||
}
|
||||
|
||||
bool MainScreen::UseVerticalLayout() const {
|
||||
return dp_yres > dp_xres * 1.1f;
|
||||
}
|
||||
|
||||
UI::EventReturn MainScreen::OnLoadFile(UI::EventParams &e) {
|
||||
|
@ -71,6 +71,9 @@ private:
|
||||
float prevHighlightProgress_;
|
||||
bool lockBackgroundAudio_;
|
||||
bool backFromStore_;
|
||||
bool lastVertical_;
|
||||
|
||||
bool UseVerticalLayout() const;
|
||||
};
|
||||
|
||||
class GamePauseScreen : public UIDialogScreenWithGameBackground {
|
||||
|
Loading…
Reference in New Issue
Block a user