src/Graphics/GameView.hh
author Tero Marttila <terom@fixme.fi>
Wed, 21 Jan 2009 23:07:22 +0200
branchnew_graphics
changeset 412 721c60072091
parent 411 106aaf6eadfe
child 414 cede5463b845
permissions -rw-r--r--
new graphics code compiles... no, it doesn't work yet
#ifndef GRAPHICS_GAME_VIEW_HH
#define GRAPHICS_GAME_VIEW_HH

#include "Drawable.hh"
#include "PlayerInfoView.hh"
#include "MessageView.hh"
#include "../GameState.hh"

#include "../Input.hh"

namespace graphics
{

/**
 * This is the main in-game view, which is what the player sees when they are playing
 */    
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;

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);
    }

public:    
    
    /**
     * Draw this view onto the given display
     */
    virtual void draw (Display &display);
    
    /**
     * Resize sub-views
     */
    virtual void resize (const PixelArea &new_area);
};

}
#endif