GameState.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef INCLUDE_GAMESTATE_h
  2. #define INCLUDE_GAMESTATE_h
  3. #include "engine/State.h"
  4. #include "map/Map.h"
  5. #include "render/Camera.h"
  6. #include "utility/Rect.h"
  7. #include "Player.h"
  8. #include <lua.hpp>
  9. namespace Pacman
  10. {
  11. enum Pacgum:uint8_t {NOTHING, NORMAL, SUPER};
  12. class GameState : public WalrusRPG::States::State {
  13. private:
  14. unsigned level;
  15. WalrusRPG::Map map;
  16. Pacgum gums[31][28];
  17. WalrusRPG::Camera cam;
  18. Player p1;
  19. Player p2;
  20. lua_State *L;
  21. bool blinky_ready;
  22. public:
  23. GameState();
  24. ~GameState();
  25. void update(unsigned dt) override;
  26. void render(unsigned dt) override;
  27. void set_gums();
  28. inline bool is_inside_map(int x, int y) { return x >= 0 && x < 224 && y >= 0 && y < 248;}
  29. bool does_collide_a_wall(WalrusRPG::Utils::Rect r);
  30. void move_player(Player &p);
  31. void render_player(WalrusRPG::Utils::Rect r);
  32. void load_ghost_script(const char* filename, const char* ghost_name, bool& ready_flag);
  33. void update_ghost(const char* ghost_name, bool& ready_flag);
  34. };
  35. }
  36. #endif