]> git.localhorst.tv Git - blank.git/blob - src/app/MessageState.cpp
more parameters for world generation
[blank.git] / src / app / MessageState.cpp
1 #include "MessageState.hpp"
2
3 #include "Environment.hpp"
4
5
6 namespace blank {
7
8 MessageState::MessageState(Environment &env)
9 : env(env) {
10         message.Position(glm::vec3(0.0f), Gravity::CENTER);
11         message.Hide();
12         press_key.Position(glm::vec3(0.0f, env.assets.large_ui_font.LineSkip(), 0.0f), Gravity::CENTER);
13         press_key.Set(env.assets.small_ui_font, "press any key to continue");
14         press_key.Show();
15 }
16
17 void MessageState::SetMessage(const char *msg) {
18         message.Set(env.assets.large_ui_font, msg);
19         message.Show();
20 }
21
22 void MessageState::ClearMessage() {
23         message.Hide();
24 }
25
26 void MessageState::Handle(const SDL_Event &e) {
27         if (e.type == SDL_KEYDOWN) {
28                 env.state.Pop();
29         }
30 }
31
32 void MessageState::Update(int dt) {
33
34 }
35
36 void MessageState::Render(Viewport &viewport) {
37         if (message.Visible()) {
38                 message.Render(viewport);
39         }
40         if (press_key.Visible()) {
41                 press_key.Render(viewport);
42         }
43 }
44
45 }