]> git.localhorst.tv Git - tacos.git/blob - src/world/Cursor.hpp
828e411209b89cb6022a997a689e7b5d83a70a4a
[tacos.git] / src / world / Cursor.hpp
1 #ifndef TACOS_WORLD_CURSOR_HPP_
2 #define TACOS_WORLD_CURSOR_HPP_
3
4 #include <GL/glew.h>
5 #include <glm/glm.hpp>
6
7
8 namespace tacos {
9
10 class Floor;
11
12 class Cursor {
13
14 public:
15         Cursor();
16         ~Cursor();
17
18         Cursor(const Cursor &) = delete;
19         Cursor &operator =(const Cursor &) = delete;
20
21         /// hide cursor
22         void Hide() noexcept;
23         /// set top left corner of cursor to focus given floor tile
24         void FloorTile(const Floor &, int tile_x, int tile_z);
25
26         bool Visible() const noexcept { return mode != HIDDEN; }
27         void Draw() const noexcept;
28
29 private:
30         GLuint vao;
31         GLuint buffers[2];
32
33         // side length in vertices (make sure it's between 2 and 8 inclusive)
34         int size;
35         // distance between cursor and ground
36         float offset;
37
38         enum Mode {
39                 HIDDEN,
40                 FLOOR,
41         } mode;
42
43         struct Attributes {
44                 glm::vec3 position;
45         };
46
47 };
48
49 }
50
51 #endif