forked from phisko/kengine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextComponent.hpp
More file actions
45 lines (36 loc) · 1.07 KB
/
Copy pathTextComponent.hpp
File metadata and controls
45 lines (36 loc) · 1.07 KB
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
37
38
39
40
41
42
43
44
45
#pragma once
#include "reflection.hpp"
#ifndef KENGINE_FONT_PATH_MAX_LENGTH
# define KENGINE_FONT_PATH_MAX_LENGTH 128
#endif
#include "string.hpp"
#include "Color.hpp"
namespace kengine {
struct TextComponent {
static constexpr char stringName[] = "TextComponentString";
using string = putils::string<KENGINE_FONT_PATH_MAX_LENGTH, stringName>;
enum class Alignment {
Left,
Center,
Right
};
string font;
string text;
size_t fontSize;
putils::NormalizedColor color;
Alignment alignment = Alignment::Center;
putils_reflection_attributes(
putils_reflection_attribute(&TextComponent::font),
putils_reflection_attribute(&TextComponent::text),
putils_reflection_attribute(&TextComponent::fontSize),
putils_reflection_attribute(&TextComponent::color),
putils_reflection_attribute(&TextComponent::alignment)
);
};
struct TextComponent2D : TextComponent { // UI element
putils_reflection_class_name(TextComponent2D);
};
struct TextComponent3D : TextComponent { // Ground feedback and such
putils_reflection_class_name(TextComponent3D);
};
}