forked from WenlinMao/SleepWalking
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTutorialMode.cpp
More file actions
52 lines (41 loc) · 1.4 KB
/
Copy pathTutorialMode.cpp
File metadata and controls
52 lines (41 loc) · 1.4 KB
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
#include "TutorialMode.hpp"
#include "LitColorTextureProgram.hpp"
#include "DrawLines.hpp"
#include "Mesh.hpp"
#include "Load.hpp"
#include "gl_errors.hpp"
#include "data_path.hpp"
TutorialMode::TutorialMode() {
tutorial = new UIBGObject(glm::vec3(0.f, 0.0f, 0.f), 2.f, 2.f, "resource/Tutorial.png");
}
TutorialMode::~TutorialMode() {
}
bool TutorialMode::handle_event(SDL_Event const& evt, glm::uvec2 const& window_size) {
if (evt.type == SDL_KEYDOWN) {
if (evt.key.keysym.sym == SDLK_SPACE) {
std::cout << "Switching to next mode" << std::endl;
Mode::set_current(std::make_shared<PlayMode>());
return true;
}
}
return false;
}
void TutorialMode::update(float elapsed) {
elpasedTime += elapsed;
if (elpasedTime > TUTORIAL_TIME) {
std::cout << "Enough time in tutorial" << std::endl;
Mode::set_current(std::make_shared<PlayMode>());
}
}
void TutorialMode::draw(glm::uvec2 const& drawable_size) {
glDisable(GL_BLEND);
// ----- set the background color -----
glm::uvec4 background_color(1, 1, 1, 0);
glClearColor(
background_color.x / 255.0f, // red
background_color.y / 255.0f, // green
background_color.z / 255.0f, // blue
background_color.w / 255.0f); // alpha
glClear(GL_COLOR_BUFFER_BIT);
tutorial->draw(*camera);
}