Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/UI/MiscScreens.h
5693 views
1
// Copyright (c) 2013- PPSSPP Project.
2
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.
6
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.
11
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
14
15
// Official git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
17
18
#pragma once
19
20
#include <functional>
21
#include <map>
22
#include <string>
23
#include <vector>
24
25
#include "Common/UI/UIScreen.h"
26
#include "Common/UI/PopupScreens.h"
27
#include "Common/File/DirListing.h"
28
#include "Common/File/Path.h"
29
#include "UI/BaseScreens.h"
30
#include "UI/SimpleDialogScreen.h"
31
32
struct ShaderInfo;
33
struct TextureShaderInfo;
34
35
inline void NoOpVoidBool(bool) {}
36
37
class BackgroundScreen : public UIScreen {
38
public:
39
ScreenRenderFlags render(ScreenRenderMode mode) override;
40
void sendMessage(UIMessage message, const char *value) override;
41
42
private:
43
void CreateViews() override {}
44
const char *tag() const override { return "bg"; }
45
46
Path gamePath_;
47
};
48
49
class PromptScreen : public UIBaseDialogScreen {
50
public:
51
PromptScreen(const Path &gamePath, std::string_view message, std::string_view yesButtonText, std::string_view noButtonText,
52
std::function<void(bool)> callback = &NoOpVoidBool);
53
54
void CreateViews() override;
55
56
void TriggerFinish(DialogResult result) override;
57
58
const char *tag() const override { return "Prompt"; }
59
60
private:
61
std::string message_;
62
std::string yesButtonText_;
63
std::string noButtonText_;
64
std::function<void(bool)> callback_;
65
};
66
67
class NewLanguageScreen : public UI::ListPopupScreen {
68
public:
69
NewLanguageScreen(std::string_view title);
70
71
const char *tag() const override { return "NewLanguage"; }
72
73
private:
74
void OnCompleted(DialogResult result) override;
75
bool ShowButtons() const override { return true; }
76
std::vector<File::FileInfo> langs_;
77
};
78
79
class TextureShaderScreen : public UI::ListPopupScreen {
80
public:
81
TextureShaderScreen(std::string_view title);
82
83
void CreateViews() override;
84
85
const char *tag() const override { return "TextureShader"; }
86
87
private:
88
void OnCompleted(DialogResult result) override;
89
bool ShowButtons() const override { return true; }
90
std::vector<TextureShaderInfo> shaders_;
91
};
92
93
enum class AfterLogoScreen {
94
TO_GAME_SETTINGS,
95
DEFAULT,
96
MEMSTICK_SCREEN_INITIAL_SETUP,
97
};
98
99
class LogoScreen : public UIScreen {
100
public:
101
LogoScreen(AfterLogoScreen afterLogoScreen = AfterLogoScreen::DEFAULT);
102
103
bool key(const KeyInput &key) override;
104
void touch(const TouchInput &touch) override;
105
void update() override;
106
void DrawForeground(UIContext &ui) override;
107
void sendMessage(UIMessage message, const char *value) override;
108
void CreateViews() override {}
109
110
const char *tag() const override { return "Logo"; }
111
112
private:
113
void Next();
114
int frames_ = 0;
115
double sinceStart_ = 0.0;
116
bool switched_ = false;
117
AfterLogoScreen afterLogoScreen_;
118
};
119
120
class CreditsScreen : public UISimpleBaseDialogScreen {
121
public:
122
CreditsScreen() : UISimpleBaseDialogScreen(Path(), SimpleDialogFlags::Default) {}
123
void update() override;
124
125
protected:
126
std::string_view GetTitle() const override;
127
128
void CreateDialogViews(UI::ViewGroup *parent) override;
129
const char *tag() const override { return "Credits"; }
130
};
131
132