author | Tero Marttila <terom@fixme.fi> |
Wed, 21 Jan 2009 23:07:22 +0200 | |
branch | new_graphics |
changeset 412 | 721c60072091 |
parent 411 | 106aaf6eadfe |
child 414 | cede5463b845 |
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_GAME_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_GAME_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 |
|
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
|
4 |
#include "Drawable.hh" |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
5 |
#include "PlayerInfoView.hh" |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
6 |
#include "MessageView.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
|
7 |
#include "../GameState.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
|
8 |
|
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
9 |
#include "../Input.hh" |
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
10 |
|
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
|
11 |
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
|
12 |
{ |
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 |
|
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 |
* This is the main in-game view, which is what the player sees when they are playing |
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 |
*/ |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
17 |
class GameView : public View { |
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
|
18 |
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
|
19 |
/** The GameState that we're drawing */ |
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 |
GameState &state; |
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
|
21 |
|
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 |
/** The player that we are controlling, if any */ |
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 |
LocalPlayer *player; |
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 |
|
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
25 |
/** |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
26 |
* The PlayerInfo view is built once we have a player |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
27 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
28 |
PlayerInfoView *info_view; |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
29 |
|
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
30 |
/** |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
31 |
* The message list view |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
32 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
33 |
MessageView message_view; |
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
34 |
|
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
35 |
/** |
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
36 |
* Input flags |
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
37 |
*/ |
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
38 |
GuiInput flags; |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
39 |
|
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
|
40 |
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
|
41 |
/** |
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
|
42 |
* Constructed once the game is running |
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
|
43 |
*/ |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
44 |
GameView (GameState &state, LocalPlayer *player); |
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
|
45 |
|
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
|
46 |
/** |
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
|
47 |
* Set a player where none was set before |
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
|
48 |
*/ |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
49 |
void setPlayer (LocalPlayer *player); |
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 |
private: |
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 |
* Calculate new area for the info_view based on our own area |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
54 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
55 |
PixelArea getInfoViewArea (void) { |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
56 |
return PixelArea(0, area.bottom - 100, area.right, area.bottom); |
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
|
57 |
} |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
58 |
|
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 |
* Calculate new area for the message view |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
61 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
62 |
PixelArea getMessageViewArea (void) { |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
63 |
return PixelArea(400, area.bottom - 100, area.right, area.bottom); |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
64 |
} |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
65 |
|
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
66 |
public: |
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
|
67 |
|
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
|
68 |
/** |
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
|
69 |
* Draw this view onto the given display |
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
|
70 |
*/ |
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
71 |
virtual void draw (Display &display); |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
72 |
|
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
73 |
/** |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
74 |
* Resize sub-views |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
75 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
76 |
virtual void resize (const PixelArea &new_area); |
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
|
77 |
}; |
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
|
78 |
|
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
|
79 |
} |
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
|
80 |
#endif |