src/Graphics/GameView.hh
branchnew_graphics
changeset 410 41fd46cffc52
child 411 106aaf6eadfe
equal deleted inserted replaced
409:1a03ff151abc 410:41fd46cffc52
       
     1 #ifndef GRAPHICS_GAME_VIEW_HH
       
     2 #define GRAPHICS_GAME_VIEW_HH
       
     3 
       
     4 #include "Drawable.hh"
       
     5 #include "../GameState.hh"
       
     6 
       
     7 namespace graphics
       
     8 {
       
     9 
       
    10 /**
       
    11  * This is the main in-game view, which is what the player sees when they are playing
       
    12  */    
       
    13 class GameView : public Drawable {
       
    14 protected:
       
    15     /** The GameState that we're drawing */
       
    16     GameState &state;
       
    17     
       
    18     /** The player that we are controlling, if any */
       
    19     LocalPlayer *player;
       
    20 
       
    21 public:
       
    22     /**
       
    23      * Constructed once the game is running
       
    24      */ 
       
    25     GameView (GameState &state, LocalPlayer *player) :
       
    26         state(state), player(player)
       
    27     {
       
    28 
       
    29     }
       
    30 
       
    31     /**
       
    32      * Set a player where none was set before
       
    33      */
       
    34     void setPlayer (LocalPlayer *player) {
       
    35         assert(!this->player);
       
    36         
       
    37         // remember it
       
    38         this->player = player;
       
    39     }
       
    40     
       
    41     /**
       
    42      * Draw this view onto the given display
       
    43      */
       
    44     void draw (Display *display);
       
    45 };
       
    46 
       
    47 }
       
    48 #endif