le2d v0.4.8
2D game engine framework
 
Loading...
Searching...
No Matches
text.hpp
Go to the documentation of this file.
1#pragma once
5
6namespace le::drawable {
8enum class TextExpand : std::int8_t { eBoth, eRight, eLeft };
9
15
17class TextBase : public IDrawPrimitive {
18 public:
20
21 [[nodiscard]] auto to_primitive() const -> Primitive final;
22
23 void set_string(IFont& font, std::string_view line, Params const& params = {});
24
25 [[nodiscard]] auto get_size() const -> glm::vec2 { return m_size; }
26 [[nodiscard]] auto get_texture() const -> ITexture const* { return m_texture; }
27
28 private:
29 TextGeometry m_geometry{};
30 std::vector<kvf::ttf::GlyphLayout> m_glyph_layouts{};
31 ITexture const* m_texture{};
32 glm::vec2 m_size{};
33};
34
36class Text : public SingleDrawPrimitive<TextBase> {};
38class InstancedText : public InstancedDrawPrimitive<TextBase> {};
39} // namespace le::drawable
Interface for drawable primitives.
Definition draw_primitive.hpp:7
Opaque interface for a Font.
Definition font.hpp:23
Concrete drawable Texture.
Definition texture.hpp:31
Base class for Draw Primitives using a vector of Render Instances.
Definition draw_primitive.hpp:26
Base class for Draw Primitives using a single Render Instance.
Definition draw_primitive.hpp:17
Drawable geometry for text.
Definition text_geometry.hpp:9
Instanced Text Draw Primitive.
Definition text.hpp:38
Base class for Text types.
Definition text.hpp:17
auto to_primitive() const -> Primitive final
auto get_texture() const -> ITexture const *
Definition text.hpp:26
auto get_size() const -> glm::vec2
Definition text.hpp:25
void set_string(IFont &font, std::string_view line, Params const &params={})
Text Draw Primitive.
Definition text.hpp:36
Definition figure.hpp:6
TextExpand
Horizontal text expansion.
Definition text.hpp:8
TextHeight
Strongly typed integer for text height.
Definition text_height.hpp:6
Draw primitive.
Definition primitive.hpp:10
Text generation parameters.
Definition text.hpp:11
TextHeight height
Definition text.hpp:12
TextExpand expand
Definition text.hpp:13