-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vector2D.h
46 lines (26 loc) · 1.01 KB
/
Vector2D.h
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
#ifndef SDLTUTORIAL_VECTOR2D_H
#define SDLTUTORIAL_VECTOR2D_H
#include <iostream>
class Vector2D {
public:
float x;
float y;
Vector2D();
Vector2D(float x, float y);
Vector2D &Add(const Vector2D &vec);
Vector2D &Sub(const Vector2D &vec);
Vector2D &Mul(const Vector2D &vec);
Vector2D &Div(const Vector2D &vec);
friend Vector2D &operator+(Vector2D &v1, const Vector2D &v2);
friend Vector2D &operator-(Vector2D &v1, const Vector2D &v2);
friend Vector2D &operator*(Vector2D &v1, const Vector2D &v2);
friend Vector2D &operator/(Vector2D &v1, const Vector2D &v2);
Vector2D &operator+=(const Vector2D &vec);
Vector2D &operator-=(const Vector2D &vec);
Vector2D &operator*=(const Vector2D &vec);
Vector2D &operator/=(const Vector2D &vec);
Vector2D &operator*(const int &i);
Vector2D &Zero();
friend std::ostream &operator<<(std::ostream &stream, const Vector2D &vec);
};
#endif //SDLTUTORIAL_VECTOR2D_H