]> git.localhorst.tv Git - blank.git/blob - src/interface.hpp
extracted configuration of various parts
[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
12
13 namespace blank {
14
15 class Chunk;
16 class World;
17
18 class Interface {
19
20 public:
21         struct Config {
22                 float move_velocity = 0.005f;
23                 float pitch_sensitivity = -0.0025f;
24                 float yaw_sensitivity = -0.001f;
25
26                 bool keyboard_disabled = false;
27                 bool mouse_disabled = false;
28                 bool visual_disabled = false;
29         };
30
31         Interface(const Config &, World &);
32
33         void Handle(const SDL_KeyboardEvent &);
34         void Handle(const SDL_MouseMotionEvent &);
35         void Handle(const SDL_MouseButtonEvent &);
36         void Handle(const SDL_MouseWheelEvent &);
37         void Handle(const SDL_WindowEvent &);
38
39         void FaceBlock();
40         void TurnBlock();
41
42         void PickBlock();
43         void PlaceBlock();
44         void RemoveBlock();
45
46         void PrintBlockInfo();
47         void PrintLightInfo();
48         void PrintSelectionInfo();
49         void Print(const Block &);
50
51         void SelectNext();
52         void SelectPrevious();
53
54         void Update(int dt);
55
56         void Render(DirectionalLighting &);
57
58 private:
59         World &world;
60         FPSController ctrl;
61         HUD hud;
62
63         Chunk *aim_chunk;
64         int aim_block;
65         glm::vec3 aim_normal;
66
67         OutlineModel outline;
68         glm::mat4 outline_transform;
69
70         Config config;
71
72         Block remove;
73         Block selection;
74
75         bool front, back, left, right, up, down;
76
77 };
78
79 }
80
81 #endif