author | Tero Marttila <terom@fixme.fi> |
Thu, 22 Jan 2009 00:28:26 +0200 | |
branch | new_graphics |
changeset 416 | 38cba347a3a9 |
parent 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" |
414
cede5463b845
port Input to new Graphics, still a bit hacky, but everything seems to work now
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
7 |
#include "Input.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
|
8 |
#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
|
9 |
|
412
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 |
/** |
414
cede5463b845
port Input to new Graphics, still a bit hacky, but everything seems to work now
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
15 |
* This is the main in-game view, which is what the player sees when they are playing. |
cede5463b845
port Input to new Graphics, still a bit hacky, but everything seems to work now
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
16 |
* |
cede5463b845
port Input to new Graphics, still a bit hacky, but everything seems to work now
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
17 |
* This enables graphics->input.gui/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
|
18 |
*/ |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
19 |
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
|
20 |
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
|
21 |
/** 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
|
22 |
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
|
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 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
|
25 |
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
|
26 |
|
411
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 |
* 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
|
29 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
30 |
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
|
31 |
|
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 |
* 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
|
34 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
35 |
MessageView message_view; |
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
36 |
|
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 |
* Input flags |
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
39 |
*/ |
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
40 |
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
|
41 |
|
416
38cba347a3a9
clean up InputHandler/GameView to use signals for input
Tero Marttila <terom@fixme.fi>
parents:
414
diff
changeset
|
42 |
CL_SlotContainer slots; |
38cba347a3a9
clean up InputHandler/GameView to use signals for input
Tero Marttila <terom@fixme.fi>
parents:
414
diff
changeset
|
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 |
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
|
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 |
* 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
|
47 |
*/ |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
48 |
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
|
49 |
|
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
|
50 |
/** |
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
|
51 |
* 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
|
52 |
*/ |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
53 |
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
|
54 |
|
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
55 |
private: |
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 |
* 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
|
58 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
59 |
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
|
60 |
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
|
61 |
} |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
62 |
|
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
63 |
/** |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
64 |
* 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
|
65 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
66 |
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
|
67 |
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
|
68 |
} |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
69 |
|
414
cede5463b845
port Input to new Graphics, still a bit hacky, but everything seems to work now
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
70 |
/** |
cede5463b845
port Input to new Graphics, still a bit hacky, but everything seems to work now
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
71 |
* Handle GUI input |
cede5463b845
port Input to new Graphics, still a bit hacky, but everything seems to work now
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
72 |
*/ |
cede5463b845
port Input to new Graphics, still a bit hacky, but everything seems to work now
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
73 |
void handleInput (GuiInput flags, TimeMS dt); |
cede5463b845
port Input to new Graphics, still a bit hacky, but everything seems to work now
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
74 |
|
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
75 |
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
|
76 |
|
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 |
* 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
|
79 |
*/ |
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
80 |
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
|
81 |
|
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
82 |
/** |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
83 |
* 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
|
84 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
410
diff
changeset
|
85 |
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
|
86 |
}; |
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
|
87 |
|
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
|
88 |
} |
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
|
89 |
#endif |