forked from 15-466/15-466-f20-base5
/
PlayMode.hpp
45 lines (35 loc) · 1.09 KB
/
PlayMode.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
#include "Mode.hpp"
#include "Scene.hpp"
#include "WalkMesh.hpp"
#include <glm/glm.hpp>
#include <vector>
#include <deque>
struct PlayMode : Mode {
PlayMode();
virtual ~PlayMode();
//functions called by main loop:
virtual bool handle_event(SDL_Event const &, glm::uvec2 const &window_size) override;
virtual void update(float elapsed) override;
virtual void draw(glm::uvec2 const &drawable_size) override;
//----- game state -----
//input tracking:
struct Button {
uint8_t downs = 0;
uint8_t pressed = 0;
} left, right, down, up;
//local copy of the game scene (so code can change it during gameplay):
Scene scene;
//stuff for scattering kernels
GLenum kernel_vertex_type = GL_TRIANGLES;
GLuint kernel_vertex_start = 0;
GLuint kernel_vertex_count = 0;
Scene::Transform *kernel = nullptr;
//player info:
struct Player {
WalkPoint at;
//transform is at player's feet and will be yawed by mouse left/right motion:
Scene::Transform *transform = nullptr;
//camera is at player's head and will be pitched by mouse up/down motion:
Scene::Camera *camera = nullptr;
} player;
};