mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-02 12:32:03 +01:00
MainScreen: Split CreateMainButtons on portrait at the top level
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
8012d9dca7
commit
ade9fc151e
1 file changed
+39
-34
+39
-34
@@ -349,55 +349,60 @@ void MainScreen::CreateMainButtons(UI::ViewGroup *parent, bool portrait) {
|
||||
using namespace UI;
|
||||
auto mm = GetI18NCategory(I18NCat::MAINMENU);
|
||||
auto di = GetI18NCategory(I18NCat::DIALOG);
|
||||
const bool showGold = !System_GetPropertyBool(SYSPROP_APP_GOLD) && (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) != DEVICE_TYPE_VR);
|
||||
|
||||
if (portrait) {
|
||||
// Icon buttons only, and no exit button - there's no space.
|
||||
parent->Add(new Spacer(1.0f, new LinearLayoutParams(1.0f)));
|
||||
if (System_GetPropertyBool(SYSPROP_HAS_FILE_BROWSER)) {
|
||||
parent->Add(new Choice(ImageID("I_FOLDER_OPEN"), new LinearLayoutParams()))->OnClick.Handle(this, &MainScreen::OnLoadFile);
|
||||
}
|
||||
parent->Add(new Choice(ImageID("I_GEAR"), new LinearLayoutParams()))->OnClick.Handle(this, &MainScreen::OnGameSettings);
|
||||
parent->Add(new Choice(ImageID("I_INFO"), new LinearLayoutParams()))->OnClick.Handle(this, &MainScreen::OnCredits);
|
||||
if (showGold) {
|
||||
Choice *gold = parent->Add(new Choice(ImageID("I_ICON_GOLD"), new LinearLayoutParams()));
|
||||
gold->OnClick.Add([this](UI::EventParams &) {
|
||||
LaunchBuyGold(this->screenManager());
|
||||
});
|
||||
gold->SetIconRight(ImageID("I_ICON_GOLD"), 0.5f);
|
||||
gold->SetImageScale(0.6f); // for the left icon.
|
||||
gold->SetShine(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (System_GetPropertyBool(SYSPROP_HAS_FILE_BROWSER)) {
|
||||
parent->Add(portrait ? new Choice(ImageID("I_FOLDER_OPEN"), portrait ? new LinearLayoutParams() : nullptr) : new Choice(mm->T("Load", "Load...")))->OnClick.Handle(this, &MainScreen::OnLoadFile);
|
||||
parent->Add(new Choice(mm->T("Load", "Load...")))->OnClick.Handle(this, &MainScreen::OnLoadFile);
|
||||
}
|
||||
parent->Add(portrait ? new Choice(ImageID("I_GEAR"), portrait ? new LinearLayoutParams() : nullptr) : new Choice(mm->T("Game Settings", "Settings")))->OnClick.Handle(this, &MainScreen::OnGameSettings);
|
||||
parent->Add(portrait ? new Choice(ImageID("I_INFO"), portrait ? new LinearLayoutParams() : nullptr) : new Choice(mm->T("About PPSSPP")))->OnClick.Handle(this, &MainScreen::OnCredits);
|
||||
parent->Add(new Choice(mm->T("Game Settings", "Settings")))->OnClick.Handle(this, &MainScreen::OnGameSettings);
|
||||
parent->Add(new Choice(mm->T("About PPSSPP")))->OnClick.Handle(this, &MainScreen::OnCredits);
|
||||
parent->Add(new Choice(mm->T("www.ppsspp.org")))->OnClick.Handle(this, &MainScreen::OnPPSSPPOrg);
|
||||
|
||||
if (!portrait) {
|
||||
parent->Add(new Choice(mm->T("www.ppsspp.org")))->OnClick.Handle(this, &MainScreen::OnPPSSPPOrg);
|
||||
}
|
||||
|
||||
if (!System_GetPropertyBool(SYSPROP_APP_GOLD) && (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) != DEVICE_TYPE_VR)) {
|
||||
Choice *gold = parent->Add(portrait ? new Choice(ImageID("I_ICON_GOLD"), portrait ? new LinearLayoutParams() : nullptr) : new Choice(mm->T("Buy PPSSPP Gold")));
|
||||
if (showGold) {
|
||||
Choice *gold = parent->Add(new Choice(mm->T("Buy PPSSPP Gold")));
|
||||
gold->OnClick.Add([this](UI::EventParams &) {
|
||||
LaunchBuyGold(this->screenManager());
|
||||
});
|
||||
gold->SetIconRight(ImageID("I_ICON_GOLD"), 0.5f);
|
||||
gold->SetImageScale(0.6f); // for the left-icon in case of vertical.
|
||||
gold->SetImageScale(0.6f);
|
||||
gold->SetShine(true);
|
||||
}
|
||||
|
||||
if (!portrait) {
|
||||
parent->Add(new Spacer(16.0));
|
||||
}
|
||||
parent->Add(new Spacer(16.0));
|
||||
|
||||
// Remove the exit button in vertical layout on all platforms, just no space.
|
||||
bool showExitButton = !portrait;
|
||||
// Also, always hide the exit button on mobile platforms that are not supposed to have one.
|
||||
#if PPSSPP_PLATFORM(IOS_APP_STORE)
|
||||
showExitButton = false;
|
||||
#elif PPSSPP_PLATFORM(ANDROID)
|
||||
// The exit button previously created problems on Android.
|
||||
// However now we allow it in landscape mode.
|
||||
showExitButton = !portrait; // System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_TV;
|
||||
#endif
|
||||
// Officially, iOS apps should not have exit buttons. Remove it to maximize app store review chances.
|
||||
if (showExitButton) {
|
||||
parent->Add(new Choice(di->T("Exit")))->OnClick.Add([](UI::EventParams &e) {
|
||||
// Let's make sure the config was saved, since it may not have been.
|
||||
if (!g_Config.Save("MainScreen::OnExit")) {
|
||||
System_Toast("Failed to save settings!\nCheck permissions, or try to restart the device.");
|
||||
}
|
||||
UpdateUIState(UISTATE_EXIT);
|
||||
// Request the framework to exit cleanly.
|
||||
System_ExitApp();
|
||||
});
|
||||
}
|
||||
// (The exit button previously created problems on Android, but now we allow it in landscape mode.)
|
||||
#if !PPSSPP_PLATFORM(IOS_APP_STORE)
|
||||
parent->Add(new Choice(di->T("Exit")))->OnClick.Add([](UI::EventParams &e) {
|
||||
// Let's make sure the config was saved, since it may not have been.
|
||||
if (!g_Config.Save("MainScreen::OnExit")) {
|
||||
System_Toast("Failed to save settings!\nCheck permissions, or try to restart the device.");
|
||||
}
|
||||
UpdateUIState(UISTATE_EXIT);
|
||||
// Request the framework to exit cleanly.
|
||||
System_ExitApp();
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainScreen::CreateViews() {
|
||||
|
||||
Reference in new issue
Block a user