A complete, fully playable Breakout arcade game built with C++17 and Raylib 4.x.
If you use CMake to build the project, it will automatically download and compile Raylib locally using FetchContent. However, if you choose to build manually using g++, you will need to install Raylib first.
- Windows: Install Raylib on Windows (e.g. using MSYS2 or MinGW)
- Linux:
sudo apt install libraylib-devor Install Raylib on Linux - macOS:
brew install raylibor Install Raylib on macOS
Run the following commands in sequence in your terminal from the project root directory (breakout-arcade/):
-
Configure the Project
cmake -B build
-
Build the Game
cmake --build build
(This will take a moment on the first run as it downloads and compiles raylib itself).
-
Run the Executable
# On Windows ./build/Debug/BreakoutArcade.exe # Or ./build/BreakoutArcade.exe depending on the generator # On Linux/macOS ./build/BreakoutArcade
If you prefer to skip CMake and have already installed raylib on your system, you can compile with a single g++ command. The executable will be output to the build/ directory.
Ensure you have MinGW installed and raylib is accessible. From the project root:
mkdir -p build && g++ src/*.cpp -o build/BreakoutArcade.exe -Iinclude -O2 -Wall -std=c++17 -lraylib -lopengl32 -lgdi32 -lwinmmmkdir -p build && g++ src/*.cpp -o build/BreakoutArcade -Iinclude -O2 -Wall -std=c++17 -lraylib -lGL -lm -lpthread -ldl -lrt -lX11mkdir -p build && g++ src/*.cpp -o build/BreakoutArcade -Iinclude -O2 -Wall -std=c++17 -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL -lraylibAfter building, you can run the executable from the compiled location:
- Windows:
build\BreakoutArcade.exe - Linux/macOS:
./build/BreakoutArcade
- A / LEFT ARROW: Move Paddle Left
- D / RIGHT ARROW: Move Paddle Right
- SPACE: Launch Ball (from Paddle), Start Game
- P: Pause Game
- R: Restart after GAME OVER or WIN