Night Byte
Vector2.hpp
1 #pragma once
2 
6 struct Vector2
7 {
8 public:
9  float x = 0;
10  float y = 0;
11 
12 
13  Vector2(){
14 
15  }
16 
17 
18  Vector2(float x, float y) : x(x), y(y)
19  {
20 
21  }
22 
23  Vector2 operator+(const Vector2& other) const {
24  return Vector2(other.x + x, other.y + y);
25  }
26 
27  Vector2 operator-(const Vector2& other) const {
28  return Vector2(other.x - x, other.y - y);
29  }
30 
31  Vector2 operator*(float scale) const {
32  return Vector2(x * scale, y * scale);
33  }
34 
35  Vector2 operator*(const Vector2& other) {
36  return Vector2(x * other.x, y * other.y);
37  }
38 
39  bool operator==(const Vector2& other) {
40  return x == other.x && y == other.y;
41  }
42 
43  bool operator<(const Vector2& other) const
44  {
45  return (x < other.x) && (y < other.y);
46  }
47 };
48 
49 
Vector2
Definition: Vector2.hpp:7