Addsy

play_state.hpp

Apr 13th, 2015
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. #if !defined PLAY_STATE_HPP
  2. #define PLAY_STATE_HPP
  3.  
  4. #include <prg_interactive.hpp>
  5. #include "snake.hpp"
  6. #include "square.hpp"
  7. #include "circle.hpp"
  8. #include "triangle.hpp"
  9. #include <list>
  10.  
  11.  
  12. //Example of forward declaration of Snake class
  13. class Snake;
  14.  
  15. class PlayState final : public prg::IAppState,
  16.                         public prg::IKeyEvent,
  17.                         public prg::ITimerEvent {
  18. public:
  19.     PlayState() = default;
  20.     bool onCreate() override;
  21.     bool onDestroy() override;
  22.     void onEntry() override;
  23.     void onExit() override;
  24.     void onUpdate() override;
  25.     void onRender(prg::Canvas& canvas) override;
  26.  
  27.     bool onKey(const prg::IKeyEvent::KeyEvent& key_event) override;
  28.     void onTimer(prg::Timer& timer) override;
  29.  
  30. private:
  31.     //Snake* snakes_[2] {nullptr,nullptr};
  32.     std::list<Snake*> snakes_;
  33.     prg::Timer game_timer_ {0, 1000 / 30, *this};
  34.     const prg::Image background_ {prg::ImageFile("resources/images/background.bmp").load()};
  35.  
  36.         std::vector<Shape> shapes_;
  37. };
  38.  
  39. #endif // PLAY_STATE_HPP
Advertisement
Add Comment
Please, Sign In to add comment