Merge pull request #90 from gizmo98/patch-2
[libretro-ppsspp.git] / UI / MiscScreens.h
blob9f7601978cdf3abd9ee2365781ee94d36f1efabe
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/.
18 #pragma once
20 #include <vector>
21 #include <map>
22 #include <string>
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 {
34 public:
35 UIScreenWithBackground() : UIScreen() {}
36 protected:
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 {
43 public:
44 UIScreenWithGameBackground(const std::string &gamePath)
45 : UIScreenWithBackground(), gamePath_(gamePath) {}
46 virtual void DrawBackground(UIContext &dc);
47 protected:
48 std::string gamePath_;
51 class UIDialogScreenWithBackground : public UIDialogScreen {
52 public:
53 UIDialogScreenWithBackground() : UIDialogScreen() {}
54 protected:
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 {
63 public:
64 UIDialogScreenWithGameBackground(const std::string &gamePath)
65 : UIDialogScreenWithBackground(), gamePath_(gamePath) {}
66 virtual void DrawBackground(UIContext &dc);
67 protected:
68 std::string gamePath_;
71 class PromptScreen : public UIDialogScreenWithBackground {
72 public:
73 PromptScreen(std::string message, std::string yesButtonText, std::string noButtonText,
74 std::function<void(bool)> callback = &NoOpVoidBool);
76 virtual void CreateViews() override;
78 private:
79 UI::EventReturn OnYes(UI::EventParams &e);
80 UI::EventReturn OnNo(UI::EventParams &e);
82 std::string message_;
83 std::string yesButtonText_;
84 std::string noButtonText_;
85 std::function<void(bool)> callback_;
88 class NewLanguageScreen : public ListPopupScreen {
89 public:
90 NewLanguageScreen(const std::string &title);
92 private:
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 {
101 public:
102 PostProcScreen(const std::string &title);
104 private:
105 virtual void OnCompleted(DialogResult result);
106 virtual bool ShowButtons() const override { return true; }
107 std::vector<ShaderInfo> shaders_;
110 class LogoScreen : public UIScreen {
111 public:
112 LogoScreen()
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() {}
120 private:
121 void Next();
122 int frames_;
123 bool switched_;
126 class CreditsScreen : public UIDialogScreenWithBackground {
127 public:
128 CreditsScreen() : frames_(0) {}
129 virtual void update(InputState &input) override;
130 virtual void render() override;
132 virtual void CreateViews();
134 private:
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);
144 int frames_;
148 // Utility functions that create various popup screens
149 ListPopupScreen *CreateLanguageScreen();