-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtext.h
36 lines (30 loc) · 932 Bytes
/
text.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// Created by piotr on 05.02.25.
//
#pragma once
#include "widget.h"
#include "thema.h"
#include "types.h"
#include <string_view>
#include <memory>
#include <SDL3/SDL_render.h>
namespace Witcher {
class Font;
class Text final : public Widget {
std::string text_;
std::shared_ptr<Font> font_;
SDL_Texture* texture_{};
public:
explicit Text(std::string text, Widget* parent = nullptr);
[[nodiscard]] std::string text() const noexcept { return text_; }
void set_color(SDL_Color const color) noexcept {
colors.normal_foreground = color;
}
void update() noexcept override;
void draw() noexcept override;
[[nodiscard]] Size size_min() const noexcept override;
[[nodiscard]] Size size_max() const noexcept override;
void update_geometry() noexcept override {}
void prepare() noexcept override;
};
}