]> git.localhorst.tv Git - blank.git/blob - src/interface.hpp
simplified block face stuff
[blank.git] / src / interface.hpp
1 #ifndef BLANK_INTERFACE_HPP_
2 #define BLANK_INTERFACE_HPP_
3
4 #include "block.hpp"
5 #include "controller.hpp"
6 #include "hud.hpp"
7 #include "model.hpp"
8 #include "shader.hpp"
9
10 #include <SDL.h>
11 #include <glm/glm.hpp>
12
13
14 namespace blank {
15
16 class Chunk;
17 class World;
18
19 class Interface {
20
21 public:
22         struct Config {
23                 float move_velocity = 0.005f;
24                 float pitch_sensitivity = -0.0025f;
25                 float yaw_sensitivity = -0.001f;
26
27                 bool keyboard_disabled = false;
28                 bool mouse_disabled = false;
29                 bool visual_disabled = false;
30         };
31
32         Interface(const Config &, World &);
33
34         void Handle(const SDL_KeyboardEvent &);
35         void Handle(const SDL_MouseMotionEvent &);
36         void Handle(const SDL_MouseButtonEvent &);
37         void Handle(const SDL_MouseWheelEvent &);
38         void Handle(const SDL_WindowEvent &);
39
40         void FaceBlock();
41         void TurnBlock();
42
43         void PickBlock();
44         void PlaceBlock();
45         void RemoveBlock();
46
47         void PrintBlockInfo();
48         void PrintChunkInfo();
49         void PrintLightInfo();
50         void PrintSelectionInfo();
51         void Print(const Block &);
52
53         void SelectNext();
54         void SelectPrevious();
55
56         void Update(int dt);
57
58         void Render(DirectionalLighting &);
59
60 private:
61         World &world;
62         FPSController ctrl;
63         HUD hud;
64
65         Chunk *aim_chunk;
66         int aim_block;
67         glm::vec3 aim_normal;
68
69         OutlineModel outline;
70         glm::mat4 outline_transform;
71
72         Config config;
73
74         Block remove;
75         Block selection;
76
77         glm::tvec3<int> fwd, rev;
78
79 };
80
81 }
82
83 #endif