15#include <SFML/Graphics.hpp>
16#include <SFML/System.hpp>
32 _text.setString(data);
41 void setText(
const std::string text)
override {
42 _text.setString(text);
46 return _text.getString();
49 void setFont(graphic::IFont *font)
override {
50 _font =
static_cast<SfmlFont *
>(font);
51 _text.setFont(_font->
handle());
55 _text.setCharacterSize(size);
58 return _text.getCharacterSize();
62 _text.setFillColor(sf::Color(color.r, color.g, color.b, color.a));
66 const sf::Color color = _text.getFillColor();
67 return Color{color.r, color.g, color.b, color.a};
71 _text.setPosition({
static_cast<float>(position.x),
static_cast<float>(position.y)});
74 const sf::Vector2f pos = _text.getPosition();
75 return Vector2f{
static_cast<double>(pos.x),
static_cast<double>(pos.y)};
79 _text.setRotation(sf::degrees(angle));
83 return _text.getRotation().asDegrees();
Sfml Font class - owns the loaded font. SfmlText only references it (sf::Text itself already takes a ...
Definition SfmlFont.hpp:27
bool isReady() const override
Definition SfmlFont.hpp:40
const sf::Font & handle() const
Definition SfmlFont.hpp:44
Sfml Text class - references a SfmlFont, does not own it. Deleting the text never touches the font.
Definition SfmlText.hpp:28
void setFontSize(unsigned int size) override
Definition SfmlText.hpp:54
void setRotation(float angle) override
Definition SfmlText.hpp:78
void setFont(graphic::IFont *font) override
Definition SfmlText.hpp:49
bool isReady() const override
Definition SfmlText.hpp:37
unsigned int getFontSize() const override
Definition SfmlText.hpp:57
void setTextColor(Color color) override
Definition SfmlText.hpp:61
void setText(const std::string text) override
Definition SfmlText.hpp:41
Vector2f getPosition() const override
Definition SfmlText.hpp:73
std::string getText() const override
Definition SfmlText.hpp:45
float getRotation() const override
Definition SfmlText.hpp:82
SfmlText(std::string data, SfmlFont &font)
Definition SfmlText.hpp:31
~SfmlText() override=default
void setPosition(Vector2f position) override
Definition SfmlText.hpp:70
Color getTextColor() const override
Definition SfmlText.hpp:65
Sfml Window class - implements IWindow2 only, sfml has no 3D.
Definition SfmlWindow.hpp:46