Dicewars-Siedler/src/engine/core/gui/uiComponent/UiText.h
2026-02-11 22:36:03 +01:00

32 lines
726 B
C++

//
// Created by sebastian on 10.02.26.
//
#ifndef DICEWARS_SIEDLER_UITEXT_H
#define DICEWARS_SIEDLER_UITEXT_H
#include "UiComponent.h"
#include "UiRenderBundle.h"
class Font;
class UiText : public UiComponent, public std::enable_shared_from_this<UiText> {
public:
UiText(Font& font, std::string text, const glm::vec2& relativePos, const glm::vec2& relativeSize);
void setText(const std::string& text);
[[nodiscard]] const Font& getFont() const { return font; }
[[nodiscard]] std::string getText() const {
return text;
}
protected:
void onCollectRenderData(UiRenderBundle &uiRenderBundle) override;
private:
std::string text;
Font& font;
};
#endif //DICEWARS_SIEDLER_UITEXT_H