2#include "../node/components.hpp"
3#include "../definitions.hpp"
4#include "../../services/graphics/graphics.hpp"
47 Label(
const std::string& text, std::shared_ptr<Font>
font);
48 Label(
const std::string& text);
56 void render(std::shared_ptr<Window> window);
57 std::shared_ptr<Font>
font;
74 template <
class Archive>
75 void save(Archive &ar)
const
77 ar(CEREAL_NVP(
size), CEREAL_NVP(
origin), CEREAL_NVP(
font), CEREAL_NVP(
visible), CEREAL_NVP(
wrap), CEREAL_NVP(color), CEREAL_NVP(direction), CEREAL_NVP(wrapWidth), CEREAL_NVP(text));
80 template <
class Archive>
83 ar(CEREAL_NVP(
size), CEREAL_NVP(
origin), CEREAL_NVP(
font), CEREAL_NVP(
visible), CEREAL_NVP(
wrap), CEREAL_NVP(color), CEREAL_NVP(direction), CEREAL_NVP(wrapWidth), CEREAL_NVP(text));
85 TTF_SetTextColor(handle, color.
r, color.
g, color.
b, color.
a);
86 TTF_SetTextDirection(handle, (TTF_Direction)direction);
87 TTF_SetTextWrapWidth(handle, wrapWidth);
90 std::string text =
"";
97 SDL_Texture *texture =
nullptr;
Definition definitions.hpp:41
Uint8 b
Definition definitions.hpp:45
static const Color WHITE
Definition definitions.hpp:58
Uint8 g
Definition definitions.hpp:44
Uint8 r
Definition definitions.hpp:43
Uint8 a
Definition definitions.hpp:46
void update(float dt)
Definition label.cpp:10
bool screenSpace
Definition label.hpp:60
~Label()
Definition label.cpp:84
void rebuildTexture()
Definition label.cpp:26
Color getColor() const
Definition label.cpp:52
std::string getText() const
Definition label.cpp:42
void render(std::shared_ptr< Window > window)
Definition label.cpp:126
void load(Archive &ar)
Definition label.hpp:81
int getWrapWidth() const
Definition label.cpp:121
Label * setColor(Color color)
Definition label.cpp:89
Vector2 size
Definition label.hpp:52
Label * setDirection(FontDirection direction)
Definition label.cpp:97
void save(Archive &ar) const
Definition label.hpp:75
SDL_Texture * getTexture() const
Definition label.cpp:21
bool visible
Definition label.hpp:58
std::shared_ptr< Font > font
Definition label.hpp:57
Label * setWrapWidth(int width)
Definition label.cpp:113
TTF_Text * getHandle() const
Definition label.cpp:47
bool wrap
Definition label.hpp:59
Vector2 origin
Definition label.hpp:53
Label()
Definition label.cpp:59
Label * setText(const std::string &text)
Definition label.cpp:105
static Graphics * graphics()
Definition services.cpp:23
FontDirection
Definition definitions.hpp:42
CEREAL_REGISTER_TYPE(Label)
CEREAL_REGISTER_POLYMORPHIC_RELATION(Component, Label)
Definition components.hpp:21
Definition definitions.hpp:77