mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Introduce SimpleBaseDialogScreen, TabbedBaseDialogScreen's simpler cousin
This commit is contained in:
@@ -1576,6 +1576,8 @@ list(APPEND NativeAppSource
|
||||
UI/MiscViews.cpp
|
||||
UI/PauseScreen.h
|
||||
UI/PauseScreen.cpp
|
||||
UI/SimpleDialogScreen.h
|
||||
UI/SimpleDialogScreen.cpp
|
||||
UI/TabbedDialogScreen.h
|
||||
UI/TabbedDialogScreen.cpp
|
||||
UI/GameScreen.h
|
||||
|
||||
@@ -40,7 +40,7 @@ bool Image::LoadPNG(const char *png_name) {
|
||||
size_t sz;
|
||||
const uint8_t *file_data = g_VFS.ReadFile(png_name, &sz);
|
||||
if (!file_data) {
|
||||
printf("Failed to load png from VFS");
|
||||
printf("Failed to load png from VFS: %s\n", png_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,6 @@ private:
|
||||
class GestureMappingScreen : public UITabbedBaseDialogScreen {
|
||||
public:
|
||||
GestureMappingScreen(const Path &gamePath) : UITabbedBaseDialogScreen(gamePath) {}
|
||||
void CreateViews() override;
|
||||
|
||||
void CreateTabs() override;
|
||||
const char *tag() const override { return "GestureMapping"; }
|
||||
|
||||
+8
-8
@@ -478,7 +478,12 @@ private:
|
||||
double dragYOffsetStart_ = 0.0;
|
||||
};
|
||||
|
||||
void CreditsScreen::CreateViews() {
|
||||
std::string_view CreditsScreen::GetTitle() const {
|
||||
auto mm = GetI18NCategory(I18NCat::MAINMENU);
|
||||
return mm->T("About PPSSPP");
|
||||
}
|
||||
|
||||
void CreditsScreen::CreateDialogViews(UI::ViewGroup *root) {
|
||||
using namespace UI;
|
||||
|
||||
ignoreBottomInset_ = false;
|
||||
@@ -489,11 +494,6 @@ void CreditsScreen::CreateViews() {
|
||||
|
||||
const bool portrait = UsePortraitLayout();
|
||||
|
||||
root_ = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
|
||||
TopBar *topBar = root_->Add(new TopBar(mm->T("About PPSSPP")));
|
||||
root_->SetDefaultFocusView(topBar->GetBackButton());
|
||||
|
||||
const bool gold = System_GetPropertyBool(SYSPROP_APP_GOLD);
|
||||
|
||||
/*
|
||||
@@ -503,9 +503,9 @@ void CreditsScreen::CreateViews() {
|
||||
root_->Add(new ImageView(ImageID("I_ICON"), "", IS_DEFAULT, new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, 10, 10, NONE, NONE, false)))->SetScale(1.5f);
|
||||
}*/
|
||||
|
||||
root_->Add(new CreditsScroller(new LinearLayoutParams(1.0f)));
|
||||
root->Add(new CreditsScroller(new LinearLayoutParams(1.0f)));
|
||||
|
||||
LinearLayout *columns = root_->Add(new LinearLayout(ORIENT_HORIZONTAL));
|
||||
LinearLayout *columns = root->Add(new LinearLayout(ORIENT_HORIZONTAL));
|
||||
|
||||
LinearLayout *left = columns->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(250.0f, WRAP_CONTENT, Margins(10))));
|
||||
LinearLayout *middle = columns->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)));
|
||||
|
||||
+7
-2
@@ -27,6 +27,7 @@
|
||||
#include "Common/File/DirListing.h"
|
||||
#include "Common/File/Path.h"
|
||||
#include "UI/BaseScreens.h"
|
||||
#include "UI/SimpleDialogScreen.h"
|
||||
|
||||
struct ShaderInfo;
|
||||
struct TextureShaderInfo;
|
||||
@@ -116,11 +117,15 @@ private:
|
||||
AfterLogoScreen afterLogoScreen_;
|
||||
};
|
||||
|
||||
class CreditsScreen : public UIBaseDialogScreen {
|
||||
class CreditsScreen : public UISimpleBaseDialogScreen {
|
||||
public:
|
||||
CreditsScreen() : UISimpleBaseDialogScreen() {}
|
||||
void update() override;
|
||||
|
||||
protected:
|
||||
void CreateViews() override;
|
||||
std::string_view GetTitle() const override;
|
||||
|
||||
void CreateDialogViews(UI::ViewGroup *parent) override;
|
||||
bool CanScroll() const override { return false; }
|
||||
const char *tag() const override { return "Credits"; }
|
||||
};
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#include "Common/UI/ScrollView.h"
|
||||
#include "UI/SimpleDialogScreen.h"
|
||||
#include "UI/MiscViews.h"
|
||||
|
||||
void UISimpleBaseDialogScreen::CreateViews() {
|
||||
using namespace UI;
|
||||
|
||||
const bool canScroll = CanScroll();
|
||||
ignoreBottomInset_ = canScroll;
|
||||
|
||||
const bool portrait = UsePortraitLayout();
|
||||
|
||||
root_ = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
root_->Add(new TopBar(GetTitle()));
|
||||
|
||||
if (canScroll) {
|
||||
ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT, 1.0f));
|
||||
LinearLayout *contents = new LinearLayoutList(ORIENT_VERTICAL);
|
||||
contents->SetSpacing(0);
|
||||
CreateDialogViews(contents);
|
||||
scroll->Add(contents);
|
||||
root_->Add(scroll);
|
||||
} else {
|
||||
CreateDialogViews(root_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "Common/UI/View.h"
|
||||
#include "Common/UI/ViewGroup.h"
|
||||
|
||||
#include "UI/BaseScreens.h"
|
||||
|
||||
// The simpler cousin of TabbedDialogScreen, without tabs or the other bling,
|
||||
// but with a consistent portrait-compatible back button and title.
|
||||
class UISimpleBaseDialogScreen : public UIBaseDialogScreen {
|
||||
public:
|
||||
UISimpleBaseDialogScreen(const Path &gamePath = Path()) : UIBaseDialogScreen(gamePath) {
|
||||
// We need to check CanScroll before we know whether to ignore
|
||||
// bottom inset. Can't do that here, we do it in CreateViews
|
||||
}
|
||||
|
||||
// Override this, don't override CreateViews. And don't touch root_ directly.
|
||||
virtual void CreateDialogViews(UI::ViewGroup *parent) = 0;
|
||||
virtual std::string_view GetTitle() const { return ""; }
|
||||
protected:
|
||||
virtual bool CanScroll() const { return true; }
|
||||
|
||||
private:
|
||||
void CreateViews() override;
|
||||
};
|
||||
+2
-1
@@ -72,6 +72,7 @@
|
||||
<ClCompile Include="AudioCommon.cpp" />
|
||||
<ClCompile Include="SystemInfoScreen.cpp" />
|
||||
<ClCompile Include="TabbedDialogScreen.cpp" />
|
||||
<ClCompile Include="SimpleDialogScreen.cpp" />
|
||||
<ClCompile Include="TiltAnalogSettingsScreen.cpp" />
|
||||
<ClCompile Include="TouchControlLayoutScreen.cpp" />
|
||||
<ClCompile Include="TouchControlVisibilityScreen.cpp" />
|
||||
@@ -369,4 +370,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -88,6 +88,9 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="TabbedDialogScreen.cpp">
|
||||
<Filter>Screens</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SimpleDialogScreen.cpp">
|
||||
<Filter>Screens</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RetroAchievementScreens.cpp">
|
||||
<Filter>Screens</Filter>
|
||||
@@ -294,4 +297,4 @@
|
||||
<UniqueIdentifier>{fda6bc55-1386-4650-a274-44fac9605ea3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -173,6 +173,7 @@
|
||||
<ClCompile Include="..\..\UI\MiscViews.cpp" />
|
||||
<ClCompile Include="..\..\UI\SystemInfoScreen.cpp" />
|
||||
<ClCompile Include="..\..\UI\TabbedDialogScreen.cpp" />
|
||||
<ClCompile Include="..\..\UI\SimpleDialogScreen.cpp" />
|
||||
<ClCompile Include="..\..\UI\RetroAchievementScreens.cpp" />
|
||||
<ClCompile Include="..\..\UI\Theme.cpp" />
|
||||
<ClCompile Include="..\..\UI\MainScreen.cpp" />
|
||||
@@ -210,4 +211,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -114,6 +114,9 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\UI\TabbedDialogScreen.cpp">
|
||||
<Filter>Screens</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\UI\SimpleDialogScreen.cpp">
|
||||
<Filter>Screens</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\UI\TiltAnalogSettingsScreen.cpp">
|
||||
<Filter>Screens</Filter>
|
||||
@@ -274,4 +277,4 @@
|
||||
<UniqueIdentifier>{38b8413d-438d-4197-9db8-7bd123fc7431}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -909,6 +909,7 @@ LOCAL_SRC_FILES := \
|
||||
$(SRC)/UI/EmuScreen.cpp \
|
||||
$(SRC)/UI/MainScreen.cpp \
|
||||
$(SRC)/UI/TabbedDialogScreen.cpp \
|
||||
$(SRC)/UI/SimpleDialogScreen.cpp \
|
||||
$(SRC)/UI/MemStickScreen.cpp \
|
||||
$(SRC)/UI/IAPScreen.cpp \
|
||||
$(SRC)/UI/MiscScreens.cpp \
|
||||
|
||||
Reference in New Issue
Block a user