aboutsummaryrefslogtreecommitdiff
path: root/src/games/breakout/Breakout.hpp
diff options
context:
space:
mode:
authorfschildt <florian.schildt@protonmail.com>2026-01-20 01:22:45 +0100
committerfschildt <florian.schildt@protonmail.com>2026-01-20 01:59:19 +0100
commit6da9be5810bf82e9d0b3b2a8bce7606ef2e2bf93 (patch)
tree28bb67ad879f8bbb36476a537fe8b69195500146 /src/games/breakout/Breakout.hpp
parentf463853872210415e06fb3f863325fdba303ab65 (diff)
breakout: delete pong, add breakout
Diffstat (limited to 'src/games/breakout/Breakout.hpp')
-rw-r--r--src/games/breakout/Breakout.hpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/games/breakout/Breakout.hpp b/src/games/breakout/Breakout.hpp
new file mode 100644
index 0000000..2b7c9b3
--- /dev/null
+++ b/src/games/breakout/Breakout.hpp
@@ -0,0 +1,45 @@
+#pragma once
+
+#include "games/Game.hpp"
+#include "common/shapes.hpp"
+
+
+class Breakout : public Game {
+ struct Paddle {
+ float x;
+ float dx;
+ };
+
+ struct Ball {
+ Circle circle;
+ float dx;
+ float dy;
+ };
+
+ static constexpr float MAP_WIDTH = 4.0f;
+ static constexpr float MAP_HEIGHT = 3.0f;
+
+ static constexpr uint32_t BRICK_ROWS = 8;
+ static constexpr uint32_t BRICK_COLS = 14;
+
+ static constexpr float PADDLE_HEIGHT = 0.1f;
+ static constexpr float PADDLE_WIDTH = 0.6f;
+ static constexpr float PADDLE_SPEED = 1.0f;
+
+
+private:
+ void Start() override;
+ void ProcessEvent(SDL_Event& event) override;
+ void Update(float dt) override;
+ void Draw() override;
+
+private:
+ void MovePaddle(float dt);
+ void MoveBall(float dt);
+
+private:
+ Rectangle m_bricks[BRICK_ROWS][BRICK_COLS];
+ Paddle m_paddle;
+ Ball m_ball;
+};
+