-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSWPoint.h
More file actions
54 lines (37 loc) · 808 Bytes
/
SWPoint.h
File metadata and controls
54 lines (37 loc) · 808 Bytes
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
/*
* SWPoint.h
* Super Tanks
*
* Created by Samuel Williams on 2/06/06.
* Copyright 2006 Samuel Williams. All rights reserved.
*
*/
#ifndef __SWPOINT__
#define __SWPOINT__
class SWPoint {
public:
SWPoint () : x(0), y(0) {
}
SWPoint (int _x, int _y) : x(_x), y(_y) {
}
SWPoint (const NSPoint& p) : x(p.x), y(p.y) {
}
void adjacentPoint (SWPoint pts[4]) { //pts must have four elements
pts[3] = SWPoint (x - 1, y);
pts[0] = SWPoint (x, y + 1);
pts[1] = SWPoint (x + 1, y);
pts[2] = SWPoint (x, y - 1);
}
int x, y;
};
class SWSize {
public:
SWSize () : width(0), height(0) {
}
SWSize (int _width, int _height) : width(_width), height(_height) {
}
SWSize (const NSSize& s) : width(s.width), height(s.height) {
}
int width, height;
};
#endif