le2d v0.4.7
2D game engine framework
 
Loading...
Searching...
No Matches
text_geometry.hpp
Go to the documentation of this file.
1#pragma once
2#include "le2d/geometry.hpp"
3#include "le2d/primitive.hpp"
5#include <kvf/ttf.hpp>
6
7namespace le {
9class TextGeometry : public IGeometry {
10 public:
11 [[nodiscard]] auto get_vertices() const -> std::span<Vertex const> final { return m_vertices.vertices; }
12 [[nodiscard]] auto get_indices() const -> std::span<std::uint32_t const> final { return m_vertices.indices; }
13 [[nodiscard]] auto get_topology() const -> vk::PrimitiveTopology final { return vk::PrimitiveTopology::eTriangleList; }
14
15 void append_glyphs(std::span<kvf::ttf::GlyphLayout const> layouts, glm::vec2 offset = {}, kvf::Color color = kvf::white_v);
16 void clear_vertices() { m_vertices.clear(); }
17
18 [[nodiscard]] auto get_vertex_array() const -> VertexArray const& { return m_vertices; }
19 [[nodiscard]] auto to_primitive(ITexture const& font_atlas) const -> Primitive;
20
21 private:
22 VertexArray m_vertices{};
23};
24} // namespace le
Interface for drawable geometry.
Definition geometry.hpp:9
Concrete drawable Texture.
Definition texture.hpp:31
Drawable geometry for text.
Definition text_geometry.hpp:9
auto get_indices() const -> std::span< std::uint32_t const > final
Definition text_geometry.hpp:12
void append_glyphs(std::span< kvf::ttf::GlyphLayout const > layouts, glm::vec2 offset={}, kvf::Color color=kvf::white_v)
auto get_vertex_array() const -> VertexArray const &
Definition text_geometry.hpp:18
auto get_topology() const -> vk::PrimitiveTopology final
Definition text_geometry.hpp:13
void clear_vertices()
Definition text_geometry.hpp:16
auto get_vertices() const -> std::span< Vertex const > final
Definition text_geometry.hpp:11
auto to_primitive(ITexture const &font_atlas) const -> Primitive
Definition animation.hpp:8
Draw primitive.
Definition primitive.hpp:10
Drawable vertex array.
Definition vertex_array.hpp:9
std::vector< Vertex > vertices
Definition vertex_array.hpp:10
std::vector< std::uint32_t > indices
Definition vertex_array.hpp:11
Drawable vertex.
Definition vertex.hpp:7