forked from phisko/kengine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebugGraphicsComponent.hpp
More file actions
56 lines (45 loc) · 1.62 KB
/
Copy pathDebugGraphicsComponent.hpp
File metadata and controls
56 lines (45 loc) · 1.62 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
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#ifndef KENGINE_DEBUG_GRAPHICS_TEXT_MAX_LENGTH
# define KENGINE_DEBUG_GRAPHICS_TEXT_MAX_LENGTH 64
#endif
#include "string.hpp"
#include "Color.hpp"
#include "Point.hpp"
namespace kengine {
class DebugGraphicsComponent {
public:
static constexpr char stringName[] = "DebugGraphicsComponentString";
using string = putils::string<KENGINE_DEBUG_GRAPHICS_TEXT_MAX_LENGTH, stringName>;
enum Type {
Text,
Line,
Sphere,
Box
};
public:
DebugGraphicsComponent() = default;
// Text
DebugGraphicsComponent(const char * text, unsigned int textSize, const char * font, const putils::Rect3f & offset, const putils::NormalizedColor & color)
: text(text), offset(offset), font(font), color(color), debugType(Text) {}
// Sphere/Line/Box
DebugGraphicsComponent(Type type, const putils::Rect3f & offset = { {}, { 1.f, 1.f, 1.f } }, const putils::NormalizedColor & color = {})
: offset(offset), color(color), debugType(type) {}
string text;
string font;
putils::NormalizedColor color;
putils::Rect3f offset{ {}, { 1.f, 1.f, 1.f } };
putils::Point3f lineEnd;
// text size: offset.size.x
// circle radius: offset.size.x
// line thickness: offset.size.y
Type debugType = Type::Box;
putils_reflection_class_name(DebugGraphicsComponent);
putils_reflection_attributes(
putils_reflection_attribute(&DebugGraphicsComponent::text),
putils_reflection_attribute(&DebugGraphicsComponent::font),
putils_reflection_attribute(&DebugGraphicsComponent::color),
putils_reflection_attribute(&DebugGraphicsComponent::offset),
putils_reflection_attribute(&DebugGraphicsComponent::debugType)
);
};
}