-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVisibleGameObject.cpp
More file actions
107 lines (93 loc) · 1.85 KB
/
VisibleGameObject.cpp
File metadata and controls
107 lines (93 loc) · 1.85 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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include "class.h"
VisibleGameObject::VisibleGameObject() : _isLoaded(false)
{
}
VisibleGameObject::~VisibleGameObject()
{
}
void VisibleGameObject::Load(string filename)
{
if(_image.LoadFromFile(filename) == false)
{
_filename = "";
_isLoaded = false;
}
else
{
_filename = filename;
_sprite.SetImage(_image);
_isLoaded = true;
}
}
void VisibleGameObject::Load(Image &load_image)
{
_image=load_image; //Must find a alternative for this
_sprite.SetImage(load_image);
_isLoaded=true;
}
void VisibleGameObject::Draw(RenderWindow & renderWindow)
{
if(_isLoaded)
{
renderWindow.Draw(_sprite);
}
}
void VisibleGameObject::SetPosition(float x, float y)
{
if(_isLoaded)
{
_sprite.SetPosition(x,y);
}
}
void VisibleGameObject::StorePosition(float x, float y)
{
if(_isLoaded)
{
xPosition=x;
yPosition=y;
}
}
void VisibleGameObject::SetPosition(void)
{
if(_isLoaded)
{
_sprite.SetPosition(xPosition,yPosition);
}
}
void VisibleGameObject::SetCenter(float x, float y)
{
if(_isLoaded)
{
_sprite.SetCenter(x, y);
}
}
void VisibleGameObject::SetSubRect (float x1, float y1, float x2, float y2)
{
if(_isLoaded)
{
_sprite.SetSubRect(IntRect(x1, y1, x2, y2));
}
}
void VisibleGameObject::DrawPos(RenderWindow & renderWindow)
{
if(_isLoaded)
{
SetPosition();
renderWindow.Draw(_sprite);
}
}
void VisibleGameObject::SetScale(float x,float y)
{
if (_isLoaded)
{
_sprite.SetScaleX(x);
_sprite.SetScaleY(y);
}
}
void VisibleGameObject::SetRotation(float rad)
{
if (_isLoaded)
{
_sprite.Rotate(rad);
}
}