forked from EasyRPG/Player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscene_title.h
199 lines (162 loc) · 4.77 KB
/
scene_title.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/*
* This file is part of EasyRPG Player.
*
* EasyRPG Player is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EasyRPG Player is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EP_SCENE_TITLE_H
#define EP_SCENE_TITLE_H
// Headers
#include "scene.h"
#include "sprite.h"
#include "window_command.h"
#include "async_handler.h"
/**
* Scene Title class.
*/
class Scene_Title : public Scene {
public:
/**
* Constructor.
*/
Scene_Title();
void Start() override;
void Continue(SceneType prev_scene) override;
void TransitionIn(SceneType prev_scene) override;
void Suspend(SceneType next_scene) override;
void vUpdate() override;
void Refresh() override;
void OnTranslationChanged() override;
/**
* Creates the background graphic of the scene.
*/
void CreateTitleGraphic();
/**
* Creates the Window displaying the options.
*/
void CreateCommandWindow();
/**
* Creates the Window displaying available translations.
*/
void CreateTranslationWindow();
/**
* Creates the Help window and hides it
*/
void CreateHelpWindow();
/**
* Plays the title music.
*/
void PlayTitleMusic();
/**
* Checks if game or engine configuration requires usage of title
* graphic and music or not.
*
* @return true when graphic and music are shown
*/
bool CheckEnableTitleGraphicAndMusic();
/**
* @return Whether the 2k3E chunk for showing the title is set
*/
bool Check2k3ShowTitle();
/**
* Checks if there is a player start location.
*
* @return true if there is one, false otherwise.
*/
bool CheckValidPlayerLocation();
/**
* Option New Game.
* Starts a new game.
*/
void CommandNewGame();
/**
* Option Continue.
* Shows the Load-Screen (Scene_Load).
*/
void CommandContinue();
/**
* Option Import.
* Shows the Import screen, for use with multi-game save files.
*/
void CommandImport();
/**
* Options the settings to configure the Player.
*/
void CommandSettings();
/**
* Option Translation.
* Shows the Translation menu, for picking between multiple languages or localizations
*/
void CommandTranslation();
/**
* Option Shutdown.
* Does a player shutdown.
*/
void CommandShutdown();
/**
* Invoked when a new game is started or a save game is loaded.
*/
void OnGameStart();
private:
void OnTitleSpriteReady(FileRequestResult* result);
/**
* Moves a window (typically the New/Continue/Quit menu) to the middle or bottom-center of the screen.
* @param window The window to resposition.
* @param center_vertical If true, the menu will be centered vertically. Otherwise, it will be at the bottom of the screen.
*/
void RepositionWindow(Window_Command& window, bool center_vertical);
/**
* Picks a new language based and switches to it.
* @param lang_str If the empty string, switches the game to 'No Translation'. Otherwise, switch to that translation by name.
*/
void ChangeLanguage(const std::string& lang_str);
void HideTranslationWindow();
/** Displays the options of the title scene. */
std::unique_ptr<Window_Command> command_window;
/** Displays all available translations (languages). */
std::unique_ptr<Window_Command> translate_window;
/** Displays help text for a given language **/
std::unique_ptr<Window_Help> help_window;
/** Contains directory names for each language; entry 0 is resverd for the default (no) translation */
std::vector<std::string> lang_dirs;
/** Contains help strings for each language; entry 0 is resverd for the default (no) translation */
std::vector<std::string> lang_helps;
/** Background graphic. */
std::unique_ptr<Sprite> title;
/**
* Current active window
* 0 = command
* 1 = translate
*/
int active_window = 0;
/**
* Offsets for each selection, in case "Import" or "Translate" is enabled.
* Listed in the order they may appear; exit_index will always be last,
* and import appears before translate, if it exists.
* Stored in a struct for easy resetting, as Scene_Title can be reused.
*/
struct CommandIndices {
int new_game = 0;
int continue_game = 1;
int import = -1;
int settings = -1;
int translate = -1;
int exit = 2;
};
CommandIndices indices;
/** Contains the state of continue button. */
bool continue_enabled = false;
bool restart_title_cache = false;
FileRequestBinding request_id;
};
#endif