Core.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #pragma once
  2. #include <SFML/Graphics.hpp>
  3. #include <SFML/Audio.hpp>
  4. #include <tmxlite/Map.hpp>
  5. #include "Shared.hpp"
  6. #include "Player.hpp"
  7. #include "NumText.hpp"
  8. #include "Portal.hpp"
  9. #include "Kebab.hpp"
  10. #include "SFMLOrthogonalLayer.hpp"
  11. #define LAYERCOUNT 5
  12. using namespace sf;
  13. struct Global {
  14. int lives;
  15. unsigned score;
  16. unsigned high;
  17. bool restart;
  18. RenderWindow window;
  19. Music music;
  20. bool reachedEast;
  21. };
  22. class Core {
  23. public:
  24. Core() = delete;
  25. Core(Global* lg);
  26. virtual ~Core();
  27. void run();
  28. private:
  29. void think(float delta);
  30. void loop(float delta);
  31. void render();
  32. Global* g;
  33. View _view;
  34. Shared _settings;
  35. Player _player;
  36. tmx::Map map;
  37. MapLayer _layer[LAYERCOUNT];
  38. Texture _background_tx;
  39. Sprite _background;
  40. Texture _evm_tx;
  41. Sprite _evm;
  42. Texture _fog_tx;
  43. Sprite _fog;
  44. Sprite _head;
  45. Texture _head_tx;
  46. Sprite _frame;
  47. Texture _frame_tx;
  48. Sprite _hud_score;
  49. Sprite _hud_highscore;
  50. Sprite _hud_time;
  51. Sprite _hud_energy;
  52. Texture _hud_tx;
  53. Texture _font;
  54. NumText _score_text;
  55. NumText _highscore_text;
  56. NumText _time_text;
  57. NumText _energy_text;
  58. RectangleShape debug;
  59. RectangleShape debug2;
  60. std::vector<Corrupted> _corrupted;
  61. std::vector<Kebab> keb;
  62. Clock _corr_clock;
  63. Portal _p1;
  64. Portal _p2;
  65. Portal _p3;
  66. Texture splashtx;
  67. Sprite splash;
  68. int _lives;
  69. Clock _s1c;
  70. Sprite _trixie;
  71. Texture _trix;
  72. bool timegranted;
  73. Texture ggtex;
  74. std::vector<Sprite> gg;
  75. SoundBuffer boom;
  76. Sound sht;
  77. std::vector<IntRect> jedi;
  78. Clock jediClock;
  79. };