Pong is a small 2D arcade game written in C++ using raylib for graphics and input and SFML for audio. Control the player paddle, return the ball, and score against an AI-controlled opponent.
Pong.mp4
- Player-versus-AI gameplay
- AI paddle that tracks the ball
- Ball and paddle collision detection
- Player and AI score tracking
- Randomized ball direction after each point
- Hit and scoring sound effects
- Custom arcade-inspired visuals
- CMake-based build configuration
| Key | Action |
|---|---|
| Up / Down | Move the player paddle |
| Space | Start the ball after a point |
| Escape | Close the game |
- A C++17-compatible compiler
- CMake 3.10 or newer
- SFML 2.6.2 with the System, Audio, Graphics, and Window components
- An internet connection during the first configuration so CMake can download raylib 5.0
The current CMake configuration expects Homebrew's
sfml@2installation on an Apple Silicon Mac.
Clone the repository and enter its directory:
git clone https://github.com/BeniNobel/Pong.git
cd PongInstall CMake and SFML 2 with Homebrew:
brew install cmake sfml@2raylib 5.0 is downloaded automatically by CMake when the project is configured.
Build and run the game from the repository root:
make
make runThe equivalent direct CMake commands are:
cmake -S . -B build
cmake --build build
./build/PongRun the executable from the repository root so it can locate the files under assets/.
To remove generated build files:
make cleanPong/
├── assets/ # Sound effects
├── include/ # Class declarations and shared game state
├── src/ # Game and class implementations
├── CMakeLists.txt # Build configuration and dependencies
├── Makefile # Convenience commands for CMake
└── README.md # Project documentation