-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCratesMode.hpp
59 lines (46 loc) · 1.58 KB
/
CratesMode.hpp
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
#pragma once
#include "Mode.hpp"
#include "WalkMesh.hpp"
#include "MeshBuffer.hpp"
#include "GL.hpp"
#include "Scene.hpp"
#include "Sound.hpp"
#include <SDL.h>
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
#include <vector>
// The 'CratesMode' shows scene with some crates in it:
struct CratesMode : public Mode {
CratesMode();
virtual ~CratesMode();
//handle_event is called when new mouse or keyboard events are received:
// (note that this might be many times per frame or never)
//The function should return 'true' if it handled the event.
virtual bool handle_event(SDL_Event const &evt, glm::uvec2 const &window_size) override;
//update is called at the start of a new frame, after events are handled:
virtual void update(float elapsed) override;
//draw is called after update:
virtual void draw(glm::uvec2 const &drawable_size) override;
//starts up a 'quit/resume' pause menu:
void show_pause_menu();
struct {
bool forward = false;
bool backward = false;
bool left = false;
bool right = false;
} controls;
bool mouse_captured = false;
Scene scene;
Scene::Camera *camera = nullptr;
Scene::Object *player = nullptr;
Scene::Object *phone_001 = nullptr;
Scene::Object *phone_002 = nullptr;
Scene::Object *phone_003 = nullptr;
Scene::Object *phone_004 = nullptr;
//when this reaches zero, the 'dot' sample is triggered at the small crate:
float dot_countdown = 1.0f;
glm::vec3 player_normal = glm::vec3(1.0f, 0.0f, 0.0f);
WalkMesh::WalkPoint walk_point;
//this 'loop' sample is played at the large crate:
std::shared_ptr< Sound::PlayingSample > loop;
};