#pragma once #include #include #include #include #include #include struct Ball { Ball(sf::Vector2f position_in, sf::Vector2f vel_in); sf::Vector2f pos; sf::Vector2f velocity; sf::Vector2f previousPos{}; bool alive{true}; bool collided{false}; }; struct Brick { Brick(sf::Vector2f position_in); sf::Vector2f pos; bool alive{true}; }; struct Player { Player() = default; Player(sf::Vector2f position_in); sf::Vector2f pos{}; sf::Vector2f previousPos{}; int score{}; int lives{3}; int mult{1}; bool left{false}; bool right{false}; }; class Game { public: Game(); void run(); void runNoImgui(); private: void imgui(); void render(); void input(); void collision(); void movement(); void updateEntities(); void checkEndGame(); void checkBallCollision(); void resetGame(); bool parseConfigFile(); void setupLevel(); void soundSystem(); void scoreSystem(); private: sf::Clock clock; sf::RenderWindow window; sf::Font font; sf::Text lives; sf::Text score; sf::Text currentMult; sf::SoundBuffer collideSoundBuffer; sf::SoundBuffer brickBreakSoundBuffer; sf::SoundBuffer failSoundBuffer; sf::Sound collideSound; sf::Sound brickBreakSound; sf::Sound failSound; Player player; std::vector balls; std::vector bricks; std::vector specialBricks; std::vector ballsToAdd; sf::CircleShape tempCircle; sf::RectangleShape tempRect; // mostly used for imgui sf::Vector2f brickSize{}; sf::Vector2f playerSize{}; sf::Vector2f playerStartPos{}; sf::Vector2f brickHalfSize{}; sf::Vector2f playerHalfSize{}; int totalSpecialBricks{}; int totalBricks{}; int framerate{}; float volume{}; float playerSpeed{}; float ballRadius{}; float ballMaxSpeed{}; Color ballColor{}; Color brickColor{}; Color playerColor{}; Color specialBrickColor{}; static constexpr unsigned int numPhysicsUpdates{4}; };