author | ekku |
Mon, 03 Nov 2008 22:20:21 +0000 | |
changeset 4 | e28b28b8817c |
parent 3 | 5a209a8585c9 |
permissions | -rw-r--r-- |
3 | 1 |
#ifndef DIMENSION_HH |
2 |
#define DIMENSION_HH |
|
3 |
||
4 |
class Dimension { |
|
5 |
public: |
|
6 |
uint32_t width; |
|
7 |
uint32_t height; |
|
8 |
||
9 |
Dimension (uint32_t width, uint32_t height) : width(width), height(height) { } |
|
10 |
}; |
|
11 |
||
12 |
class Coordinate { |
|
13 |
public: |
|
14 |
uint32_t x; |
|
15 |
uint32_t y; |
|
16 |
||
17 |
Coordinate (uint32_t x, uint32_t y) : x(x), y(y) { } |
|
18 |
||
19 |
Coordinate &operator+= (const PositionDelta &d) { |
|
20 |
this->x += d.dx; |
|
21 |
this->y += d.dy; |
|
22 |
} |
|
4
e28b28b8817c
Drawer lis?tty. Pari metodia gamestateen ja dimensioniin.
ekku
parents:
3
diff
changeset
|
23 |
|
e28b28b8817c
Drawer lis?tty. Pari metodia gamestateen ja dimensioniin.
ekku
parents:
3
diff
changeset
|
24 |
uint32_t scaledX() { |
e28b28b8817c
Drawer lis?tty. Pari metodia gamestateen ja dimensioniin.
ekku
parents:
3
diff
changeset
|
25 |
// Scale the coordinate so that it |
e28b28b8817c
Drawer lis?tty. Pari metodia gamestateen ja dimensioniin.
ekku
parents:
3
diff
changeset
|
26 |
// matches the pixel resolution |
e28b28b8817c
Drawer lis?tty. Pari metodia gamestateen ja dimensioniin.
ekku
parents:
3
diff
changeset
|
27 |
return this->x/1; |
e28b28b8817c
Drawer lis?tty. Pari metodia gamestateen ja dimensioniin.
ekku
parents:
3
diff
changeset
|
28 |
} |
e28b28b8817c
Drawer lis?tty. Pari metodia gamestateen ja dimensioniin.
ekku
parents:
3
diff
changeset
|
29 |
|
e28b28b8817c
Drawer lis?tty. Pari metodia gamestateen ja dimensioniin.
ekku
parents:
3
diff
changeset
|
30 |
uint32_t scaledY() { |
e28b28b8817c
Drawer lis?tty. Pari metodia gamestateen ja dimensioniin.
ekku
parents:
3
diff
changeset
|
31 |
return this->y/1; |
e28b28b8817c
Drawer lis?tty. Pari metodia gamestateen ja dimensioniin.
ekku
parents:
3
diff
changeset
|
32 |
} |
3 | 33 |
}; |
34 |
||
35 |
class PositionDelta { |
|
36 |
public: |
|
37 |
uint32_t dx; |
|
38 |
uint32_t dy; |
|
39 |
||
40 |
PositionDelta (uint32_t dx, uint32_t dy) : dx(dx), dy(dy) { } |
|
41 |
}; |
|
42 |
||
43 |
#endif |