-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTransformComponent.cpp
74 lines (57 loc) · 1.06 KB
/
TransformComponent.cpp
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
#include "TransformComponent.hpp"
TransformComponent::TransformComponent(GameObject* go) : Component(go)
{
}
TransformComponent::~TransformComponent()
{
}
void TransformComponent::setPosition(float x, float y)
{
position.x = x;
position.y = y;
}
void TransformComponent::setScale(float x, float y)
{
scale.x = x;
scale.y = y;
}
void TransformComponent::setRotation(float r)
{
rotation = r;
}
glm::vec2 TransformComponent::getPosition()
{
return position;
}
glm::vec2 TransformComponent::getScale()
{
return scale;
}
float TransformComponent::getRotation()
{
return rotation;
}
void TransformComponent::setPositionX(float x)
{
position.x = x;
}
void TransformComponent::setPositionY(float y)
{
position.y = y;
}
void TransformComponent::setScaleX(float x)
{
scale.x = x;
}
void TransformComponent::setScaleY(float y)
{
scale.y = y;
}
void TransformComponent::translate(float x, float y) {
position.x += x;
position.y += y;
}
void TransformComponent::rotate(float r)
{
rotation += r;
}