17#ifndef _FGE_C_OBJTEXT_HPP_INCLUDED
18#define _FGE_C_OBJTEXT_HPP_INCLUDED
27#include "FastEngine/fge_extern.hpp"
28#include "C_object.hpp"
29#include "FastEngine/accessor/C_font.hpp"
30#include "FastEngine/graphic/C_glyph.hpp"
34#define FGE_OBJTEXT_CLASSNAME "FGE:OBJ:TEXT"
48 void addLine(
bool outlineVertices,
53 float outlineThickness = 0.0f);
54 void addGlyphQuad(
bool outlineVertices,
55 fge::Vector2f
const& size,
57 fge::Vector2i
const& textureSize,
67 [[nodiscard]]
fge::Color const& getFillColor()
const;
68 [[nodiscard]]
fge::Color const& getOutlineColor()
const;
70 void setVisibility(
bool visibility);
71 [[nodiscard]]
bool isVisible()
const;
73 [[nodiscard]] uint32_t getUnicode()
const;
84 uint32_t g_unicodeChar{0};
86 bool g_visibility{
true};
98 StrikeThrough = 1 << 3
102 ObjText(tiny_utf8::string
string,
104 fge::Vector2f
const& position = {},
105 fge::CharacterSize characterSize = 30);
106 explicit ObjText(
fge::Font font, fge::Vector2f
const& position = {}, fge::CharacterSize characterSize = 30);
113 void setString(tiny_utf8::string
string);
115 void setCharacterSize(fge::CharacterSize size);
117 void setLineSpacingFactor(
float spacingFactor);
118 void setLetterSpacingFactor(
float spacingFactor);
120 void setStyle(std::underlying_type<Style>::type style);
123 void setOutlineColor(
fge::Color const& color);
125 void setOutlineThickness(
float thickness);
127 tiny_utf8::string
const& getString()
const;
129 fge::CharacterSize getCharacterSize()
const;
131 [[nodiscard]]
float getLetterSpacingFactor()
const;
132 [[nodiscard]]
float getLineSpacingFactor()
const;
133 [[nodiscard]]
float getLineSpacing()
const;
134 [[nodiscard]]
float getGlyphAdvance(uint32_t c)
const;
136 std::underlying_type<Style>::type getStyle()
const;
141 float getOutlineThickness()
const;
143 fge::Vector2f findCharacterPos(std::size_t index)
const;
145 std::vector<fge::Character>& getCharacters();
146 std::vector<fge::Character>
const& getCharacters()
const;
162 void ensureGeometryUpdate()
const;
164 tiny_utf8::string g_string;
166 fge::CharacterSize g_characterSize{30};
167 float g_letterSpacingFactor{1.0f};
168 float g_lineSpacingFactor{1.0f};
169 std::underlying_type<Style>::type g_style{Regular};
172 float g_outlineThickness{0.0f};
174 mutable std::vector<Character> g_characters;
176 mutable bool g_geometryNeedUpdate{
false};
177 mutable uint32_t g_fontTextureModificationCount{0};
Definition C_objText.hpp:42
Definition C_color.hpp:35
This class is a wrapper for the font manager to allow easy manipulation.
Definition C_font.hpp:35
Definition C_glyph.hpp:33
Definition C_objText.hpp:90
void unpack(fge::net::Packet const &pck) override
Unpack the object from a packet.
Style
Definition C_objText.hpp:93
char const * getReadableClassName() const override
Get a readable version of the class name.
fge::RectFloat getGlobalBounds() const override
Get the global bounds of the object.
void pack(fge::net::Packet &pck) override
Pack the object into a packet.
void save(nlohmann::json &jsonObject, fge::Scene *scene) override
Save the object to a json object.
fge::RectFloat getLocalBounds() const override
Get the local bounds of the object (without any transformations)
char const * getClassName() const override
Get the unique class name of the object.
void load(nlohmann::json &jsonObject, fge::Scene *scene) override
Load the object from a json object.
The Object class is the base class for all objects in the engine.
Definition C_object.hpp:102
The RenderStates class contains all the information needed to render something.
Definition C_renderStates.hpp:412
Definition C_renderTarget.hpp:56
A scene contain a collection of object and handle them.
Definition C_scene.hpp:450
Definition C_packet.hpp:70
Definition C_vertexBuffer.hpp:45