--- a/src/Graphics/GameView.hh Wed Jan 21 01:57:24 2009 +0200
+++ b/src/Graphics/GameView.hh Wed Jan 21 03:33:35 2009 +0200
@@ -2,6 +2,8 @@
#define GRAPHICS_GAME_VIEW_HH
#include "Drawable.hh"
+#include "PlayerInfoView.hh"
+#include "MessageView.hh"
#include "../GameState.hh"
namespace graphics
@@ -10,7 +12,7 @@
/**
* This is the main in-game view, which is what the player sees when they are playing
*/
-class GameView : public Drawable {
+class GameView : public View {
protected:
/** The GameState that we're drawing */
GameState &state;
@@ -18,30 +20,53 @@
/** The player that we are controlling, if any */
LocalPlayer *player;
+ /**
+ * The PlayerInfo view is built once we have a player
+ */
+ PlayerInfoView *info_view;
+
+ /**
+ * The message list view
+ */
+ MessageView message_view;
+
public:
/**
* Constructed once the game is running
*/
- GameView (GameState &state, LocalPlayer *player) :
- state(state), player(player)
- {
-
- }
+ GameView (GameState &state, LocalPlayer *player);
/**
* Set a player where none was set before
*/
- void setPlayer (LocalPlayer *player) {
- assert(!this->player);
-
- // remember it
- this->player = player;
+ void setPlayer (LocalPlayer *player);
+
+private:
+ /**
+ * Calculate new area for the info_view based on our own area
+ */
+ PixelArea getInfoViewArea (void) {
+ return PixelArea(0, area.bottom - 100, area.right, area.bottom);
}
+
+ /**
+ * Calculate new area for the message view
+ */
+ PixelArea getMessageViewArea (void) {
+ return PixelArea(400, area.bottom - 100, area.right, area.bottom);
+ }
+
+public:
/**
* Draw this view onto the given display
*/
- void draw (Display *display);
+ virtual void draw (Display *display);
+
+ /**
+ * Resize sub-views
+ */
+ virtual void resize (const PixelArea &new_area);
};
}