equal
deleted
inserted
replaced
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 } |
|
23 |
|
24 uint32_t scaledX() { |
|
25 // Scale the coordinate so that it |
|
26 // matches the pixel resolution |
|
27 return this->x/1; |
|
28 } |
|
29 |
|
30 uint32_t scaledY() { |
|
31 return this->y/1; |
|
32 } |
|
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 |
|