State.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * Triangles
  3. * Copyright (C) 2016 POSITIVE MENTAL ATTITUDE
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, version 3 of the License.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #pragma once
  18. #include <SFML/Window.hpp>
  19. #include "Assets.hpp"
  20. #include "TrianglesWindow.hpp"
  21. #include "Context.hpp"
  22. /**
  23. * @class State
  24. * @author POSITIVE MENTAL ATTITUDE
  25. * @date 06/09/16
  26. * @file State.hpp
  27. * @brief This is an abstract base state class.
  28. */
  29. class State
  30. {
  31. public:
  32. enum {
  33. Ongoing = -1, Loading = 0, Menu = 1, Ingame = 2, Empty = 3
  34. };
  35. State();
  36. virtual ~State();
  37. void setContext(Context* context);
  38. virtual void init() = 0;
  39. virtual void refresh() = 0;
  40. virtual void coreThink(const sf::Event& event) = 0;
  41. virtual void coreInput() = 0;
  42. virtual void coreUpdate(sf::Time delta) = 0;
  43. virtual void coreRender(const bool shaders) = 0;
  44. const int status() const;
  45. protected:
  46. Context* _context;
  47. int _status;
  48. };