Tileson  1.3.0
A helpful json parser for Tiled maps
Vector2.hpp
Go to the documentation of this file.
1 //
2 // Created by robin on 31.07.2019.
3 //
4 
5 #ifndef TILESON_VECTOR2_HPP
6 #define TILESON_VECTOR2_HPP
7 
8 namespace tson
9 {
10  template<typename T>
11  class Vector2
12  {
13 
14  public:
15  inline Vector2(T xPos, T yPos);
16  inline Vector2() { x = y = 0; }
17 
18  inline bool operator==(const Vector2 &rhs) const;
19  inline bool operator!=(const Vector2 &rhs) const;
20 
21  T x;
22  T y;
23  };
24 
31  template<typename T>
32  Vector2<T>::Vector2(T xPos, T yPos)
33  {
34  x = xPos;
35  y = yPos;
36  }
37 
38  template<typename T>
39  bool Vector2<T>::operator==(const Vector2 &rhs) const
40  {
41  return x == rhs.x &&
42  y == rhs.y;
43  }
44 
45  template<typename T>
46  bool Vector2<T>::operator!=(const Vector2 &rhs) const
47  {
48  return !(rhs == *this);
49  }
50 
53 }
54 
55 #endif //TILESON_VECTOR2_HPP
Definition: Vector2.hpp:12
T y
Definition: Vector2.hpp:22
T x
Definition: Vector2.hpp:21
Vector2()
Definition: Vector2.hpp:16
bool operator==(const Vector2 &rhs) const
Definition: Vector2.hpp:39
Vector2(T xPos, T yPos)
Definition: Vector2.hpp:32
bool operator!=(const Vector2 &rhs) const
Definition: Vector2.hpp:46
Definition: Base64.hpp:12
Vector2< float > Vector2f
Definition: Vector2.hpp:52
Vector2< int > Vector2i
Definition: Vector2.hpp:51