46 Text(
const std::string &text =
"",
const std::string &name =
"Text");
58 void set_text(
const std::string &text);
65 inline const std::string &
get_text()
const {
return m_text; }
72 void set_font(std::shared_ptr<Font> font);
79 inline std::shared_ptr<Font>
get_font()
const {
return m_font; }
86 inline void set_color(
const glm::vec4 &color) { m_color = color; }
93 inline const glm::vec4 &
get_color()
const {
return m_color; }
116 void render(
float canvas_width,
float canvas_height,
const glm::mat4 &projection)
override;
123 std::shared_ptr<Font> m_font;
126 glm::vec4 m_color{1.0f, 1.0f, 1.0f, 1.0f};
132 static std::shared_ptr<renderer::Shader> s_shader;
135 static std::shared_ptr<renderer::VertexArray> s_vao;
138 static std::shared_ptr<renderer::VertexBuffer> s_vbo;
141 static void initialize_resources();
144 static bool s_initialized;
std::shared_ptr< Font > get_font() const
Get the current font.
Definition text.hpp:79
const std::string & get_text() const
Get the text string.
Definition text.hpp:65
void set_alignment(TextAlign align)
Set text alignment.
Definition text.hpp:100
void render(float canvas_width, float canvas_height, const glm::mat4 &projection) override
Render the text.
Definition text.cpp:71
void set_font(std::shared_ptr< Font > font)
Set the font.
Definition text.cpp:55
TextAlign get_alignment() const
Get text alignment.
Definition text.hpp:107
const glm::vec4 & get_color() const
Get the text color.
Definition text.hpp:93
Text(const std::string &text="", const std::string &name="Text")
Constructor for Text.
Definition text.cpp:27
void set_color(const glm::vec4 &color)
Set the text color.
Definition text.hpp:86
void set_text(const std::string &text)
Set the text string.
Definition text.cpp:50