Darkwater

state.cpp

May 10th, 2013
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #define IN_MENU 0
  2. #define IN_GAME 1
  3.  
  4. namespace game {
  5.  
  6. class State
  7. {
  8. public:
  9.     State(sf::RenderWindow *window)
  10.     {
  11.         this->window = window;
  12.         this->location = IN_MENU;
  13.  
  14.         menu.addButton(game::Button(100, 100, 400, 200, "test"));
  15.     }
  16.  
  17.     void setLocation(int where)
  18.     {
  19.         location = where;
  20.     }
  21.  
  22.     void update(float dt)
  23.     {
  24.         menu.update(sf::Mouse::getPosition(*window));
  25.     }
  26.  
  27.     void draw()
  28.     {
  29.         menu.draw(*window);
  30.     }
  31.  
  32. private:
  33.     int location;
  34.     sf::RenderWindow *window;
  35.     game::Menu menu;
  36. };
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment