CPong is a recreation of the classic pong video game. Implemented in the C programming language, using SDL2 library to display graphics on the screen.
- Classic Pong Gameplay: Player vs Computer with realistic ball physics
- Intelligent AI: Computer opponent that adapts to ball movement
- Pause System: In-game pause menu with resume, restart, and exit options
- Resizable Window: Dynamic scaling that maintains aspect ratio
- Score Tracking: Visual score display using bitmap fonts
- Game States: Main menu, gameplay, pause menu, and game over screens
- Smooth Controls: Responsive paddle movement with 60 FPS gameplay
- C compiler (GCC, Clang, or Visual Studio)
- SDL2 development libraries
- Operating System: Windows, Linux, or macOS
- SDL2 (libSDL2-dev on Ubuntu/Debian)
- Standard C library
# Install SDL2 development libraries
sudo apt-get install libsdl2-dev
# Compile the game
gcc -o pong pong3.c -lSDL2 -lSDL2main
# Run the game
./pong# Install SDL2 development libraries for MinGW
# Download SDL2 development libraries from libsdl.org
# Compile (adjust paths as needed)
gcc -o pong.exe pong3.c -lSDL2 -lSDL2main -lmingw32
# Run the game
pong.exe# Install SDL2 using Homebrew
brew install sdl2
# Compile the game
gcc -o pong pong3.c -lSDL2 -lSDL2main
# Run the game
./pongThe game requires the following bitmap (.bmp) files in the same directory as the executable:
title.bmp- Main menu background imageplayer_win.bmp- Player victory screenai_win.bmp- AI victory screen
Create a digits/ folder with:
digits/0.bmpthroughdigits/10.bmp- Number sprites for score display
resume.bmp- Resume option imagerestart.bmp- Restart option imageexit.bmp- Exit option image
SPACE- Start gameESC- Exit application
UP Arrow- Move player paddle upDOWN Arrow- Move player paddle downMouse Click- Click pause button (top-right corner)ESC- Exit to desktop
UP/DOWN Arrows- Navigate menu optionsENTERorSPACE- Select highlighted option- Options: Resume, Restart, Exit to Main Menu
SPACE- Return to main menuESC- Exit application
- Objective: First player to reach 10 points wins
- Scoring: Ball exits the screen on opponent's side
- Ball Physics: Speed increases slightly after each paddle hit
- Paddle Physics: Ball angle changes based on where it hits the paddle
- AI Behavior: Computer paddle follows ball movement intelligently