#pragma once #include "Util.h" #include "Player.h" #include "Fruit.h" #include "GameConfig.h" #include #include #include #include enum class GameState { playing, lose, win }; class Game { public: Game(bool useImgui_in); void run(); bool init(); private: void imgui(); void render(); void input(); void collision(); void movement(); void resetGame(); bool parseConfigFile(); void soundSystem(); void scoreSystem(); void failState(); void winState(); private: GameConfig config; sf::Clock clock; sf::RenderWindow window; sf::Font font; sf::Text score; sf::SoundBuffer failSoundBuffer; sf::SoundBuffer winSoundBuffer; sf::SoundBuffer bgMusicBuffer; sf::SoundBuffer eatSoundBuffer; sf::SoundBuffer moveSoundBuffer; sf::Sound failSound; sf::Sound winSound; sf::Sound bgMusic; sf::Sound eatSound; sf::Sound moveSound; sf::RectangleShape tempRect; //sf::Sound failSound; Player player{}; Fruit fruit{}; sf::Vector2u gridCount; size_t frameCount{}; size_t fruitEaten{}; GameState state{GameState::playing}; bool useImgui; bool fail{}; bool win{}; bool running{true}; };