main.cpp 737 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include <SFML/Graphics.hpp>
  2. #include "Core.hpp"
  3. #include "Echo.hpp"
  4. using namespace sf;
  5. int main()
  6. {
  7. srand(time(nullptr));
  8. Global g;
  9. g.music.openFromFile("data/music.ogg");
  10. g.music.setLoop(true);
  11. g.music.play();
  12. g.window.create(VideoMode(256, 224),
  13. "Zombies 'n Kebabs", Style::Default,
  14. ContextSettings(0, 0, 0, 2, 0));
  15. g.window.setFramerateLimit(240);
  16. g.window.setSize({1024, 896});
  17. g.window.setKeyRepeatEnabled(false);
  18. g.restart = true;
  19. g.lives = 2;
  20. g.score = 0;
  21. g.high = 0;
  22. g.reachedEast = false;
  23. while(g.restart) {
  24. g.restart = true;
  25. Core core(&g);
  26. core.run();
  27. if(g.lives < 0) {
  28. if(g.score > g.high)
  29. g.high = g.score;
  30. g.score = 0;
  31. g.lives = 2;
  32. g.reachedEast = false;
  33. }
  34. }
  35. return 0;
  36. }