1 // Copyright (c) 2013- PPSSPP Project.
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, version 2.0 or later versions.
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License 2.0 for more details.
12 // A copy of the GPL 2.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
15 // Official git repository and contact information can be found at
16 // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
24 #include "file/file_util.h"
25 #include "base/functional.h"
26 #include "ui/ui_screen.h"
27 #include "GPU/Common/PostShader.h"
29 extern std::string boot_filename
;
31 inline void NoOpVoidBool(bool) {}
33 class UIScreenWithBackground
: public UIScreen
{
35 UIScreenWithBackground() : UIScreen() {}
37 virtual void DrawBackground(UIContext
&dc
);
38 virtual void sendMessage(const char *message
, const char *value
) override
;
39 virtual UI::EventReturn
OnLanguageChange(UI::EventParams
&e
);
42 class UIScreenWithGameBackground
: public UIScreenWithBackground
{
44 UIScreenWithGameBackground(const std::string
&gamePath
)
45 : UIScreenWithBackground(), gamePath_(gamePath
) {}
46 virtual void DrawBackground(UIContext
&dc
);
48 std::string gamePath_
;
51 class UIDialogScreenWithBackground
: public UIDialogScreen
{
53 UIDialogScreenWithBackground() : UIDialogScreen() {}
55 virtual void DrawBackground(UIContext
&dc
);
56 virtual void sendMessage(const char *message
, const char *value
) override
;
57 virtual UI::EventReturn
OnLanguageChange(UI::EventParams
&e
);
59 void AddStandardBack(UI::ViewGroup
*parent
);
62 class UIDialogScreenWithGameBackground
: public UIDialogScreenWithBackground
{
64 UIDialogScreenWithGameBackground(const std::string
&gamePath
)
65 : UIDialogScreenWithBackground(), gamePath_(gamePath
) {}
66 virtual void DrawBackground(UIContext
&dc
);
68 std::string gamePath_
;
71 class PromptScreen
: public UIDialogScreenWithBackground
{
73 PromptScreen(std::string message
, std::string yesButtonText
, std::string noButtonText
,
74 std::function
<void(bool)> callback
= &NoOpVoidBool
);
76 virtual void CreateViews() override
;
79 UI::EventReturn
OnYes(UI::EventParams
&e
);
80 UI::EventReturn
OnNo(UI::EventParams
&e
);
83 std::string yesButtonText_
;
84 std::string noButtonText_
;
85 std::function
<void(bool)> callback_
;
88 class NewLanguageScreen
: public ListPopupScreen
{
90 NewLanguageScreen(const std::string
&title
);
93 virtual void OnCompleted(DialogResult result
);
94 virtual bool ShowButtons() const override
{ return true; }
95 std::map
<std::string
, std::pair
<std::string
, int>> langValuesMapping
;
96 std::map
<std::string
, std::string
> titleCodeMapping
;
97 std::vector
<FileInfo
> langs_
;
100 class PostProcScreen
: public ListPopupScreen
{
102 PostProcScreen(const std::string
&title
);
105 virtual void OnCompleted(DialogResult result
);
106 virtual bool ShowButtons() const override
{ return true; }
107 std::vector
<ShaderInfo
> shaders_
;
110 class LogoScreen
: public UIScreen
{
113 : frames_(0), switched_(false) {}
114 bool key(const KeyInput
&key
) override
;
115 virtual void update(InputState
&input
) override
;
116 virtual void render() override
;
117 virtual void sendMessage(const char *message
, const char *value
) override
;
118 virtual void CreateViews() {}
126 class CreditsScreen
: public UIDialogScreenWithBackground
{
128 CreditsScreen() : frames_(0) {}
129 virtual void update(InputState
&input
) override
;
130 virtual void render() override
;
132 virtual void CreateViews();
135 UI::EventReturn
OnOK(UI::EventParams
&e
);
137 UI::EventReturn
OnSupport(UI::EventParams
&e
);
138 UI::EventReturn
OnPPSSPPOrg(UI::EventParams
&e
);
139 UI::EventReturn
OnForums(UI::EventParams
&e
);
140 UI::EventReturn
OnChineseForum(UI::EventParams
&e
);
141 UI::EventReturn
OnShare(UI::EventParams
&e
);
142 UI::EventReturn
OnTwitter(UI::EventParams
&e
);
148 // Utility functions that create various popup screens
149 ListPopupScreen
*CreateLanguageScreen();