terom@410: #ifndef GRAPHICS_GAME_VIEW_HH terom@410: #define GRAPHICS_GAME_VIEW_HH terom@410: terom@410: #include "Drawable.hh" terom@411: #include "PlayerInfoView.hh" terom@411: #include "MessageView.hh" terom@414: #include "Input.hh" terom@410: #include "../GameState.hh" terom@410: terom@412: terom@410: namespace graphics terom@410: { terom@410: terom@410: /** terom@414: * This is the main in-game view, which is what the player sees when they are playing. terom@414: * terom@414: * This enables graphics->input.gui/player terom@410: */ terom@411: class GameView : public View { terom@410: protected: terom@410: /** The GameState that we're drawing */ terom@410: GameState &state; terom@410: terom@410: /** The player that we are controlling, if any */ terom@410: LocalPlayer *player; terom@410: terom@411: /** terom@411: * The PlayerInfo view is built once we have a player terom@411: */ terom@411: PlayerInfoView *info_view; terom@411: terom@411: /** terom@411: * The message list view terom@411: */ terom@411: MessageView message_view; terom@412: terom@412: /** terom@412: * Input flags terom@412: */ terom@412: GuiInput flags; terom@411: terom@416: CL_SlotContainer slots; terom@416: terom@410: public: terom@410: /** terom@410: * Constructed once the game is running terom@410: */ terom@411: GameView (GameState &state, LocalPlayer *player); terom@410: terom@410: /** terom@410: * Set a player where none was set before terom@410: */ terom@411: void setPlayer (LocalPlayer *player); terom@411: terom@411: private: terom@411: /** terom@411: * Calculate new area for the info_view based on our own area terom@411: */ terom@411: PixelArea getInfoViewArea (void) { terom@411: return PixelArea(0, area.bottom - 100, area.right, area.bottom); terom@410: } terom@411: terom@411: /** terom@411: * Calculate new area for the message view terom@411: */ terom@411: PixelArea getMessageViewArea (void) { terom@411: return PixelArea(400, area.bottom - 100, area.right, area.bottom); terom@411: } terom@411: terom@414: /** terom@414: * Handle GUI input terom@414: */ terom@414: void handleInput (GuiInput flags, TimeMS dt); terom@414: terom@411: public: terom@410: terom@410: /** terom@410: * Draw this view onto the given display terom@410: */ terom@412: virtual void draw (Display &display); terom@411: terom@411: /** terom@411: * Resize sub-views terom@411: */ terom@411: virtual void resize (const PixelArea &new_area); terom@410: }; terom@410: terom@410: } terom@410: #endif