YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
SpatialInfo.cpp
Go to the documentation of this file.
1
#include "
YAPOG/Graphics/SpatialInfo.hpp
"
2
3
namespace
yap
4
{
5
SpatialInfo::SpatialInfo
()
6
{
7
Init
(
DEFAULT_POSITION
,
DEFAULT_SIZE
);
8
}
9
10
SpatialInfo::SpatialInfo
(
const
Vector2
& position,
const
Vector2
& size)
11
{
12
Init
(position, size);
13
}
14
15
SpatialInfo::SpatialInfo
(
const
SpatialInfo
& copy)
16
{
17
Init
(copy.
position_
, copy.
size_
);
18
}
19
20
SpatialInfo
&
SpatialInfo::operator=
(
const
SpatialInfo
& copy)
21
{
22
if
(
this
== ©)
23
return
*
this
;
24
25
Init
(copy.
position_
, copy.
size_
);
26
27
return
*
this
;
28
}
29
30
const
Vector2
&
SpatialInfo::GetPosition
()
const
31
{
32
return
position_
;
33
}
34
35
const
Vector2
&
SpatialInfo::GetSize
()
const
36
{
37
return
size_
;
38
}
39
40
const
Vector2
&
SpatialInfo::GetTopLeft
()
const
41
{
42
return
topLeft_
;
43
}
44
45
const
Vector2
&
SpatialInfo::GetBottomRight
()
const
46
{
47
return
bottomRight_
;
48
}
49
50
const
Vector2
&
SpatialInfo::GetCenter
()
const
51
{
52
return
center_
;
53
}
54
55
const
sf::FloatRect
&
SpatialInfo::GetRectangle
()
const
56
{
57
return
rectangle_
;
58
}
59
60
void
SpatialInfo::SetPosition
(
const
Vector2
& position)
61
{
62
position_
= position;
63
64
Update
();
65
}
66
67
void
SpatialInfo::SetSize
(
const
Vector2
& size)
68
{
69
size_
= size;
70
71
Update
();
72
}
73
74
void
SpatialInfo::Init
(
const
Vector2
& position,
const
Vector2
& size)
75
{
76
position_
= position;
77
size_
= size;
78
79
Update
();
80
}
81
82
void
SpatialInfo::Update
()
83
{
84
center_
=
position_
+
size_
/ 2.0f;
85
topLeft_
=
position_
;
86
bottomRight_
=
position_
+
size_
;
87
88
rectangle_
=
sf::FloatRect
(
position_
, size_);
89
}
90
}
// namespace yap
YAPOG
src
YAPOG
Graphics
SpatialInfo.cpp
Generated on Mon Sep 17 2012 22:24:26 for YAPOG by
1.8.1.1