1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- #ifndef DEBUGGERS_H
- #define DEBUGGERS_H
-
- #include "olcPGEX_Sound.h"
- #include "olcPixelGameEngine.h"
-
- #include "bonus.h"
- #include "bug.h"
- #include "player.h"
- #include "programmer.h"
-
- #include <chrono>
- #include <map>
- #include <random>
- #include <string>
- #include <vector>
-
- namespace pabloader {
- class Debuggers : public olc::PixelGameEngine {
- private:
- std::vector<Programmer*> programmers;
- std::vector<Bonus*> bonuses;
-
- std::map<BonusType, uint32_t> bonusesCatched;
-
- uint32_t bugsCatched = 0;
- uint32_t bugsMissed = 0;
-
- uint8_t linesOfCode = 5;
- uint16_t totalLines;
- std::vector<std::string> sourceCode;
- std::random_device rd;
- std::mt19937 generator;
-
- public:
- Debuggers()
- : generator(rd())
- {
- sAppName = "Debuggers";
- }
-
- public:
- bool OnUserCreate() override;
- bool OnUserUpdate(float fElapsedTime) override;
- bool OnUserDestroy() override;
- int GameScreenHeight() { return ScreenHeight() - linesOfCode * 10; };
-
- template <typename T>
- T GetRandom(T from = 0, T to = 1);
-
- private:
- void SpawnProgrammer();
- void SpawnBug();
- void SpawnBonus();
- Bug* CreateBug();
- Bonus* CreateBonus();
- bool GameOver();
-
- public:
- std::vector<Bug*> bugs;
-
- olc::ResourcePack pack;
-
- olc::Sprite playerSprite;
- olc::Sprite enemiesSprite;
- olc::Sprite bonusesSprite;
- olc::Sprite backgroundSprite;
-
- int playerFallSample;
- int bugFallSample;
- int bugCatchSample;
-
- const int gravity = 30;
- };
- }
-
- #endif
|