#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 #include #include #include #include #include namespace pabloader { enum GameState { STATE_MAIN_MENU, STATE_GAME, STATE_PAUSE_MENU, STATE_GAME_OVER, STATE_HELP, STATE_QUIT }; class Debuggers : public olc::PixelGameEngine { private: std::list programmers; std::list bonuses; std::map bonusesCatched; uint32_t bugsCatched = 0; uint32_t bugsCatchedByPlayer = 0; uint32_t bugsMissed = 0; uint8_t linesOfCode = 5; uint16_t totalLines; std::list originalSourceCode; std::list sourceCode; GameState state = STATE_MAIN_MENU; std::mt19937 generator; public: Debuggers() : generator(std::chrono::system_clock::now().time_since_epoch().count()) { sAppName = "Debuggers"; } public: bool OnUserCreate() override; bool OnUserUpdate(float fElapsedTime) override; bool OnUserDestroy() override; int GameScreenHeight() { return ScreenHeight() - linesOfCode * 10; } GameState GetState() { return state; } template T GetRandom(T from = 0, T to = 1); private: void ResetGame(); void SwitchState(GameState newState); void DrawMenu(); void SpawnPlayer(); void SpawnProgrammer(); void SpawnBug(); void SpawnBonus(); Bug* CreateBug(); Bonus* CreateBonus(); private: // Gamemodes bool MainMenu(float dt); bool GamePlay(float dt); bool PauseMenu(float dt); bool GameOver(float dt); bool HelpMenu(float dt); public: std::list 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 = 25; #ifdef _DEBUG bool debug = false; #endif }; } #endif