-
Notifications
You must be signed in to change notification settings - Fork 0
/
HUDWidget.h
89 lines (73 loc) · 1.51 KB
/
HUDWidget.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#pragma once
#include "EntityComponentSystemManager.h"
#include "Vector3D.h"
#include "Point.h"
#include "HUD.h"
#include <iostream>
struct TransformComponent2D
{
Point position;
Point scale;
};
extern EntityComponentSystemManager m_EntityComponentSystemManager;
class HUDWidget
{
public:
HUDWidget()
{
}
~HUDWidget()
{
}
virtual void Tick(float DeltaTime)
{
//std::cout << DeltaTime;
}
virtual void BeginPlay()
{
}
void SetEntityID(Entity IDToSet)
{
m_ID = IDToSet;
}
Entity GetEntityID()
{
return m_ID;
}
void SetName(const char Name[32])
{
memcpy(m_name, Name, sizeof(const char));
}
char GetName()
{
return m_ID;
}
void SetVisibility(bool visible)
{
m_visible = visible;
}
void SetOffset(WidgetPositionOffset offset)
{
m_offset = offset;
}
void SetPosition(Point widget_position)
{
auto& transform = m_EntityComponentSystemManager->GetComponent<TransformComponent2D>(m_ID);
transform.position = widget_position;
}
void SetScale(Point widget_scale)
{
auto& transform = m_EntityComponentSystemManager->GetComponent<TransformComponent2D>(m_ID);
transform.scale = widget_scale;
}
void setECS(EntityComponentSystemManager* ECS)
{
m_EntityComponentSystemManager = ECS;
}
protected:
Entity m_ID{};
char m_name[32]{};
WidgetPositionOffset m_offset = WidgetPositionOffset::Center;
bool m_visible= true;
EntityComponentSystemManager* m_EntityComponentSystemManager= nullptr;
};