very early prototype of a spaceshooter in SFML
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

game.hpp 884B

123456789101112131415161718192021222324252627282930313233343536
  1. #include <string>
  2. #include <SFML/System.hpp>
  3. #include <SFML/Window.hpp>
  4. #include "player.hpp"
  5. #include "level.hpp"
  6. #pragma once
  7. namespace Proto4 {
  8. enum class GameState { Uninitialized, Running, Paused, Finished };
  9. class Game : public sf::Drawable, public sf::Transformable {
  10. public:
  11. virtual void draw(sf::RenderTarget &window, sf::RenderStates states) const;
  12. AppState update(sf::RenderWindow &window, sf::Time timestep);
  13. AppState handleKey(const sf::Event &event);
  14. void resize(sf::Event& resizeEvent);
  15. sf::View& getMainView();
  16. bool init();
  17. void pause();
  18. void resume();
  19. private:
  20. bool start();
  21. bool reset();
  22. sf::View mainView{};
  23. GameState state = GameState::Uninitialized;
  24. Player player{};
  25. Level level{};
  26. uint32_t score = 0;
  27. };
  28. }