Loading...
Searching...
No Matches
Text.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith. All rights reserved.
2// Malena Framework — Proprietary Software. See LICENSE for terms.
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
88 void setWordWrap(bool word_wrap);
89
99 void setMaxWidth(float max_width);
100
101 private:
102 bool wordWrap = false;
103 float maxWidth = 0.f;
104 };
105
116 template<typename Manifest>
117 class TextWidth : public Text, public Customizable<Manifest> {}; // TODO: rename to TextWith
118
119} // namespace ml
120
121#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.
Text(const sf::Font &font=FontManager<>::getDefault())
Construct a Text object with a given font.
Text with an attached manifest.
Definition Text.h:117
#define MALENA_API
Definition Component.h:22