Loading...
Searching...
No Matches
Text.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith.
2// Malena Framework — Licensed under PolyForm Noncommercial 1.0.0; commercial use requires a paid license. See LICENSE.
3
4#ifndef MALENA_TEXT_H
5#define MALENA_TEXT_H
6
7#pragma once
8
13
14namespace ml
15{
56 class MALENA_API Text : public virtual Graphic<sf::Text>
57 {
58 public:
59 using Graphic::Graphic;
60
67 explicit Text(const sf::Font& font = FontManager<>::getDefault());
68
77 void setString(const sf::String& text);
78
89 void setString(const std::string& bytes);
90 void setString(const char* bytes);
91
101 void setWordWrap(bool word_wrap);
102
112 void setMaxWidth(float max_width);
113
114 private:
115 bool wordWrap = false;
116 float maxWidth = 0.f;
117 };
118
129 template<typename Manifest>
130 class TextWidth : public Text, public Customizable<Manifest> {}; // TODO: rename to TextWith
131
132} // namespace ml
133
134#endif // MALENA_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.
void setString(const char *bytes)
Text(const sf::Font &font=FontManager<>::getDefault())
Construct a Text object with a given font.
void setString(const std::string &bytes)
Set the text from a UTF-8 encoded string.
Text with an attached manifest.
Definition Text.h:130
#define MALENA_API
Definition Animate.h:25