Skip to content

Jeemit12/Brick_Breaker_Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

🧱 Brick Breaker Game using C++ STL and OpenGL (FreeGLUT)

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.


📸 Screenshot

Screenshot 2026-04-13 021954


🎮 Game Overview

  • 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


🧠 Concepts Used

C++ Concepts

  • STL vector (2D grid for bricks)
  • Functions & modular programming
  • Loops & conditions
  • Event-driven programming
  • Game state management

Graphics Concepts

  • OpenGL 2D rendering
  • FreeGLUT window management
  • Real-time animation using glutTimerFunc
  • Mouse input handling
  • Collision detection
  • Primitive drawing (GL_POINTS, GL_QUADS)

🛠 Technologies Used

  • Language: C++
  • Graphics Library: OpenGL
  • Toolkit: FreeGLUT
  • Concepts: STL (vector)
  • Platform: Windows / Linux / Mac

📂 Project Structure

project-folder
│
├── main.cpp
└── README.md

🎯 Features

  • 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)

🎮 Controls

Action Control
Move Paddle Mouse Movement
Restart Game Mouse Click on Button

⚙️ Installation

Install FreeGLUT

Windows

  • Download FreeGLUT and link libraries in your compiler

Linux (Ubuntu)

sudo apt-get install freeglut3 freeglut3-dev

Mac

brew install freeglut

▶️ Compile and Run

g++ main.cpp -o game -lglut -lGL -lGLU
./game

🕹 Gameplay Logic

Ball

  • Moves continuously
  • Bounces off walls and paddle
  • Breaks bricks on collision

Paddle

  • Moves horizontally using mouse
  • Reflects the ball upward

Bricks

  • Stored using vector<vector<bool>>
  • Disappear when hit

📊 Scoring System

Action Points
Break Brick +10

👉 Final score is displayed after game ends


🔄 Game Loop

Game updates using:

glutTimerFunc(16, update, 0);

📚 Learning Outcomes

  • 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

🔮 Future Improvements

  • Add sound effects 🔊
  • Add multiple levels 🎮
  • Add power-ups ⚡
  • Improve graphics 🎨
  • Add keyboard controls ⌨️
  • Add score UI during gameplay

👨‍💻 Creators

  • Jeemit Patel
  • Jeet Vasoya
  • Shasan Shah

📜 License

This project is created for educational purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages