summaryrefslogtreecommitdiff
path: root/ui/text.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-01-01 13:01:08 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-01-01 14:40:06 +0000
commit1f68fe78e84f25c8ddacdc37a293a5de31725bab (patch)
tree4537db483391b579387c1bcc00c3f1e3b6adc106 /ui/text.h
parentAdd glm::vec concatenation operator|| (diff)
downloadilt-1f68fe78e84f25c8ddacdc37a293a5de31725bab.tar.bz2
ilt-1f68fe78e84f25c8ddacdc37a293a5de31725bab.tar.xz
ilt-1f68fe78e84f25c8ddacdc37a293a5de31725bab.zip
First iteration with font/text support
Diffstat (limited to 'ui/text.h')
-rw-r--r--ui/text.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/ui/text.h b/ui/text.h
new file mode 100644
index 0000000..81122de
--- /dev/null
+++ b/ui/text.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "uiComponent.h"
+#include <GL/glew.h>
+#include <glBuffers.h>
+#include <glVertexArrays.h>
+#include <glm/glm.hpp>
+#include <string_view>
+#include <vector>
+
+class UIShader;
+union SDL_Event;
+
+class Text : public UIComponent {
+public:
+ Text(std::string_view s, Position, glm::vec3 colour);
+
+ void render(const UIShader &, const Position & parentPos) const override;
+ bool handleInput(const SDL_Event &, const Position & parentPos) override;
+
+private:
+ struct Model {
+ Model(GLuint, GLsizei);
+ GLuint texture;
+ GLsizei count;
+ glVertexArray vao;
+ glBuffer vbo;
+ };
+ std::vector<Model> models;
+ glm::vec3 colour;
+};