Loading...
Searching...
No Matches
Text.h
Go to the documentation of this file.
1#ifndef TEXT_H
2#define TEXT_H
3
4#pragma once
5
9
10namespace ml
11{
53 class Text : public virtual Graphic<sf::Text>
54 {
55 public:
56 using Graphic::Graphic;
57
64 explicit Text(const sf::Font& font = FontManager<>::getDefault());
65
74 void setString(const sf::String& text);
75
85 void setWordWrap(bool word_wrap);
86
96 void setMaxWidth(float max_width);
97
98 private:
99 bool wordWrap = false;
100 float maxWidth = 0.f;
101 };
102
113 template<typename Manifest>
114 class TextWidth : public Text, public Customizable<Manifest> {}; // TODO: rename to TextWith
115
116} // namespace ml
117
118#endif // TEXT_H
Customizable()=default
static const sf::Font & getDefault()
Return the built-in Arial font.
void setWordWrap(bool word_wrap)
Enable or disable automatic word wrapping.
void setString(const sf::String &text)
Set the displayed string, applying word-wrap if enabled.
void setMaxWidth(float max_width)
Set the maximum layout width for word wrapping.
Text(const sf::Font &font=FontManager<>::getDefault())
Construct a Text object with a given font.
Text with an attached manifest.
Definition Text.h:114
Definition Component.h:18