-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathVector2.cpp
70 lines (56 loc) · 806 Bytes
/
Vector2.cpp
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "Vector2.h"
Vector2::Vector2(void)
{
Set(0,0);
}
Vector2::Vector2(int x, int y)
{
Set(x, y);
}
Vector2::~Vector2(void)
{
}
void Vector2::Set(int newX, int newY)
{
x = newX;
y = newY;
}
bool Vector2::operator==(const Vector2 rhs)
{
// compare
if(x == rhs.x && y == rhs.y)
{
// equal
return true;
}
// something didnt match
return false;
}
//////////////////////////////////////////////////////////////////////////
Vector2f::Vector2f(void)
{
Set(0,0);
}
Vector2f::Vector2f(float x, float y)
{
Set(x, y);
}
Vector2f::~Vector2f(void)
{
}
void Vector2f::Set(float newX, float newY)
{
x = newX;
y = newY;
}
bool Vector2f::operator==(const Vector2f rhs)
{
// compare
if(x == rhs.x && y == rhs.y)
{
// equal
return true;
}
// something didnt match
return false;
}