Ingen beskrivning
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.

debuggers.h 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef DEBUGGERS_H
  2. #define DEBUGGERS_H
  3. #include "bug.h"
  4. #include "olcPGEX_Sound.h"
  5. #include "olcPixelGameEngine.h"
  6. #include "programmer.h"
  7. #include "player.h"
  8. #include <vector>
  9. #include <string>
  10. namespace pabloader {
  11. class Debuggers : public olc::PixelGameEngine {
  12. private:
  13. std::vector<Programmer*> programmers;
  14. uint32_t bugsCatched = 0;
  15. uint32_t bugsMissed = 0;
  16. uint8_t linesOfCode = 5;
  17. uint16_t totalLines;
  18. std::vector<std::string> sourceCode;
  19. public:
  20. Debuggers()
  21. {
  22. sAppName = "Debuggers";
  23. }
  24. public:
  25. bool OnUserCreate() override;
  26. bool OnUserUpdate(float fElapsedTime) override;
  27. bool OnUserDestroy() override;
  28. int GameScreenHeight() { return ScreenHeight() - linesOfCode * 10; };
  29. private:
  30. void SpawnProgrammer();
  31. void SpawnBug();
  32. Bug* CreateBug();
  33. bool GameOver();
  34. public:
  35. std::vector<Bug*> bugs;
  36. olc::ResourcePack pack;
  37. olc::Sprite playerSprite;
  38. olc::Sprite enemiesSprite;
  39. olc::Sprite backgroundSprite;
  40. int playerFallSample;
  41. int bugFallSample;
  42. int bugCatchSample;
  43. };
  44. }
  45. #endif