]> git.localhorst.tv Git - blank.git/blob - src/interface.hpp
use light levels for shading of blocks
[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 PrintChunkInfo();
48         void PrintLightInfo();
49         void PrintSelectionInfo();
50         void Print(const Block &);
51
52         void SelectNext();
53         void SelectPrevious();
54
55         void Update(int dt);
56
57         void Render(DirectionalLighting &);
58
59 private:
60         World &world;
61         FPSController ctrl;
62         HUD hud;
63
64         Chunk *aim_chunk;
65         int aim_block;
66         glm::vec3 aim_normal;
67
68         OutlineModel outline;
69         glm::mat4 outline_transform;
70
71         Config config;
72
73         Block remove;
74         Block selection;
75
76         bool front, back, left, right, up, down;
77
78 };
79
80 }
81
82 #endif