#ifndef GRAPHICS_GAME_VIEW_HH
#define GRAPHICS_GAME_VIEW_HH
#include "Drawable.hh"
#include "PlayerInfoView.hh"
#include "MessageView.hh"
#include "Input.hh"
#include "../GameState.hh"
namespace graphics
{
/**
* This is the main in-game view, which is what the player sees when they are playing.
*
* This enables graphics->input.gui/player
*/
class GameView : public View {
protected:
/** The GameState that we're drawing */
GameState &state;
/** 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;
/**
* Input flags
*/
GuiInput flags;
CL_SlotContainer slots;
public:
/**
* Constructed once the game is running
*/
GameView (GameState &state, LocalPlayer *player);
/**
* Set a player where none was set before
*/
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);
}
/**
* Handle GUI input
*/
void handleInput (GuiInput flags, TimeMS dt);
public:
/**
* Draw this view onto the given display
*/
virtual void draw (Display &display);
/**
* Resize sub-views
*/
virtual void resize (const PixelArea &new_area);
};
}
#endif