A simple and interactive Brick Breaker Game developed using C++, STL (vector), and OpenGL (FreeGLUT).
The player controls a paddle to bounce a ball and break bricks arranged at the top.
-
A ball moves continuously and bounces across the screen
-
Player controls a paddle at the bottom using the mouse
-
Bricks are arranged in rows at the top
-
Ball breaks bricks on collision
-
Game ends if ball misses the paddle
-
Player wins if all bricks are destroyed
-
Restart button appears after game ends
-
Final score is displayed at the end
- STL
vector(2D grid for bricks) - Functions & modular programming
- Loops & conditions
- Event-driven programming
- Game state management
- OpenGL 2D rendering
- FreeGLUT window management
- Real-time animation using
glutTimerFunc - Mouse input handling
- Collision detection
- Primitive drawing (
GL_POINTS,GL_QUADS)
- Language: C++
- Graphics Library: OpenGL
- Toolkit: FreeGLUT
- Concepts: STL (vector)
- Platform: Windows / Linux / Mac
project-folder
│
├── main.cpp
└── README.md
- Paddle controlled by mouse 🖱️
- Ball movement with collision physics ⚽
- Brick breaking system 🧱
- Game Over and Victory conditions 🏁
- Restart button functionality 🔘
- Score calculation system 🎯
- Smooth animation (~60 FPS)
- Ball rendered using GL_POINTS (circle math)
| Action | Control |
|---|---|
| Move Paddle | Mouse Movement |
| Restart Game | Mouse Click on Button |
- Download FreeGLUT and link libraries in your compiler
sudo apt-get install freeglut3 freeglut3-dev
brew install freeglut
g++ main.cpp -o game -lglut -lGL -lGLU
./game
- Moves continuously
- Bounces off walls and paddle
- Breaks bricks on collision
- Moves horizontally using mouse
- Reflects the ball upward
- Stored using
vector<vector<bool>> - Disappear when hit
| Action | Points |
|---|---|
| Break Brick | +10 |
👉 Final score is displayed after game ends
Game updates using:
glutTimerFunc(16, update, 0);
- Understanding of STL in real-time applications
- Basics of 2D game development
- OpenGL rendering techniques
- Collision detection implementation
- Event-driven programming using GLUT
- Timer-based game loop
- Add sound effects 🔊
- Add multiple levels 🎮
- Add power-ups ⚡
- Improve graphics 🎨
- Add keyboard controls ⌨️
- Add score UI during gameplay
- Jeemit Patel
- Jeet Vasoya
- Shasan Shah
This project is created for educational purposes.
