]> git.localhorst.tv Git - tacos.git/blobdiff - src/world/Cursor.hpp
mouse cursor mockup
[tacos.git] / src / world / Cursor.hpp
diff --git a/src/world/Cursor.hpp b/src/world/Cursor.hpp
new file mode 100644 (file)
index 0000000..828e411
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef TACOS_WORLD_CURSOR_HPP_
+#define TACOS_WORLD_CURSOR_HPP_
+
+#include <GL/glew.h>
+#include <glm/glm.hpp>
+
+
+namespace tacos {
+
+class Floor;
+
+class Cursor {
+
+public:
+       Cursor();
+       ~Cursor();
+
+       Cursor(const Cursor &) = delete;
+       Cursor &operator =(const Cursor &) = delete;
+
+       /// hide cursor
+       void Hide() noexcept;
+       /// set top left corner of cursor to focus given floor tile
+       void FloorTile(const Floor &, int tile_x, int tile_z);
+
+       bool Visible() const noexcept { return mode != HIDDEN; }
+       void Draw() const noexcept;
+
+private:
+       GLuint vao;
+       GLuint buffers[2];
+
+       // side length in vertices (make sure it's between 2 and 8 inclusive)
+       int size;
+       // distance between cursor and ground
+       float offset;
+
+       enum Mode {
+               HIDDEN,
+               FLOOR,
+       } mode;
+
+       struct Attributes {
+               glm::vec3 position;
+       };
+
+};
+
+}
+
+#endif