-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCVector2i.h
More file actions
62 lines (47 loc) · 1.2 KB
/
CVector2i.h
File metadata and controls
62 lines (47 loc) · 1.2 KB
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
#ifndef _CVECTOR2I_H
#define _CVECTOR2I_H
#include <iostream>
#include <ostream>
#include <stdlib.h>
#include <math.h>
#include "ForceInline.h"
using namespace std;
class CVector2i {
public:
finline CVector2i() { x = y = 0; }
finline CVector2i(int X_, int Y_){
x = X_; y = Y_;
}
finline CVector2i operator+(CVector2i v){
return CVector2i(v.x + x, v.y + y);
}
finline CVector2i operator-(CVector2i v){
return CVector2i(x - v.x, y - v.y);
}
finline CVector2i operator*(int value){
return CVector2i(x * value, y * value);
}
finline CVector2i operator/(int value){
return CVector2i(x / value, y / value);
}
finline bool operator== (CVector2i v){
if (x == v.x && y == v.y)
return true;
else
return false;
}
finline bool operator!= (CVector2i v){
if (x == v.x && y == v.y)
return false;
else
return true;
}
finline CVector2i operator-() const {
return CVector2i(-x, -y);
}
finline CVector2i operator*(CVector2i v){
return CVector2i(x * v.x, y * v.y);
}
int x, y;
};
#endif