YAPOG  0.0.1
Yet Another Pokemon Online Game
SpatialInfo.cpp
Go to the documentation of this file.
2 
3 namespace yap
4 {
6  {
8  }
9 
10  SpatialInfo::SpatialInfo (const Vector2& position, const Vector2& size)
11  {
12  Init (position, size);
13  }
14 
16  {
17  Init (copy.position_, copy.size_);
18  }
19 
21  {
22  if (this == &copy)
23  return *this;
24 
25  Init (copy.position_, copy.size_);
26 
27  return *this;
28  }
29 
31  {
32  return position_;
33  }
34 
35  const Vector2& SpatialInfo::GetSize () const
36  {
37  return size_;
38  }
39 
41  {
42  return topLeft_;
43  }
44 
46  {
47  return bottomRight_;
48  }
49 
51  {
52  return center_;
53  }
54 
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 
83  {
84  center_ = position_ + size_ / 2.0f;
87 
89  }
90 } // namespace yap