author | Tero Marttila <terom@fixme.fi> |
Tue, 27 Jan 2009 00:25:58 +0200 | |
changeset 439 | 9823e6cd1086 |
parent 413 | 7dddc163489a |
permissions | -rw-r--r-- |
410
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
1 |
#ifndef GRAPHICS_VIEW_HH |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
2 |
#define GRAPHICS_VIEW_HH |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
3 |
|
413 | 4 |
namespace graphics |
5 |
{ |
|
6 |
||
7 |
class View; |
|
8 |
||
9 |
} |
|
10 |
||
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
11 |
#include "Drawable.hh" |
413 | 12 |
#include "Display.hh" |
410
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
13 |
#include "../Types.hh" |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
14 |
|
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
15 |
namespace graphics |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
16 |
{ |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
17 |
|
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
18 |
/** |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
19 |
* A view is some area of the display that displays something |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
20 |
*/ |
413 | 21 |
class View /* : public Drawable */ { |
410
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
22 |
protected: |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
23 |
/** |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
24 |
* The area of the screen that is ours to draw on |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
25 |
*/ |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
26 |
PixelArea area; |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
27 |
|
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
28 |
public: |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
29 |
/** |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
30 |
* Set the initial area that is drawn into |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
31 |
*/ |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
32 |
View (const PixelArea &area) : |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
33 |
area(area) |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
34 |
{ |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
35 |
|
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
36 |
} |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
37 |
|
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
38 |
/** |
413 | 39 |
* Draw into the view area |
40 |
*/ |
|
41 |
virtual void draw (Display &display) = 0; |
|
42 |
||
43 |
/** |
|
410
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
44 |
* Update the view area |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
45 |
*/ |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
46 |
virtual void resize (const PixelArea &new_area) { |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
47 |
this->area = new_area; |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
48 |
} |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
49 |
|
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
50 |
/** |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
51 |
* Get current width |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
52 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
53 |
PixelDimension getWidth (void) const { |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
54 |
return area.right - area.left; |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
55 |
} |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
56 |
|
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
57 |
/** |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
58 |
* Get current height |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
59 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
60 |
PixelDimension getHeight (void) const { |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
61 |
return area.bottom - area.top; |
410
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
62 |
} |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
63 |
}; |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
64 |
|
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
65 |
} |
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
66 |
|
41fd46cffc52
start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
67 |
#endif |