summaryrefslogtreecommitdiff
path: root/ui/text.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-27 21:47:41 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-27 21:47:41 +0000
commite0ac130808d9bed5443115ee91e9cccda713ae3c (patch)
treedad2b2cbe2bc8bf5560f4859880549472f808671 /ui/text.h
parentRemove the static texture cache (diff)
parentRender text in N draw calls (diff)
downloadilt-e0ac130808d9bed5443115ee91e9cccda713ae3c.tar.bz2
ilt-e0ac130808d9bed5443115ee91e9cccda713ae3c.tar.xz
ilt-e0ac130808d9bed5443115ee91e9cccda713ae3c.zip
Merge branch 'text2'
Diffstat (limited to 'ui/text.h')
-rw-r--r--ui/text.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/ui/text.h b/ui/text.h
index de2fe2e..31ed9a5 100644
--- a/ui/text.h
+++ b/ui/text.h
@@ -1,31 +1,29 @@
#pragma once
+#include "font.h"
+#include "glContainer.h"
#include "uiComponent.h"
#include <glArrays.h>
#include <glad/gl.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);
+ Text(std::string_view s, const Font &, 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;
- };
+ Text & operator=(const std::string_view s);
- std::vector<Model> models;
+private:
+ std::vector<std::pair<GLuint, std::pair<GLsizei, GLint>>> models;
+ glContainer<Font::Quad> quads;
+ glVertexArray vao;
glm::vec3 colour;
+ const Font & font;
};