added phonies to make, added fps to debug
[physics.git] / src / Vector2.h
CommitLineData
ad9f1fb6
PG
1#ifndef VECTOR2_H
2#define VECTOR2_H
3
4#include <string>
5
6using std::string;
7
8/// ***** Header Class *****
9class Vector2
10{
11 public:
12 float x;
13 float y;
14
15 Vector2();
16 Vector2(float, float);
17 Vector2(const Vector2&);
18
19 void zero();
20 void unit();
21
22 float angle() const;
23 float length() const;
24
25 Vector2 add(const Vector2&) const;
26 Vector2 subtract(const Vector2&) const;
27 Vector2 divide(float) const;
28 Vector2 multiply(float) const;
29
30 string toString() const;
31 void print() const;
32};
33
34/// ***** Header Methods *****
35// definitions of the operators are external
36// because (float, Vector2) would fail inside class
37Vector2 operator+(const Vector2&, const Vector2&);
38Vector2 operator-(const Vector2&, const Vector2&);
39Vector2 operator*(float, const Vector2&);
40Vector2 operator*(const Vector2&, float);
41Vector2 operator/(const Vector2&, float);
42
43void operator+=(Vector2&, const Vector2&);
44void operator-=(Vector2&, const Vector2&);
45void operator*=(Vector2&, float);
46void operator/=(Vector2&, float);
47
48#endif // VECTOR2_H