Skip to content

AKumarOfficial/Pong

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pong

A classic single-player Pong game built with C++17 and SFML 2.5.

Features

  • Smooth bat movement with bounded clamping
  • Randomised ball direction on each new life
  • Score tracking (incremented on top-wall bounces)
  • Lives system with Game Over screen
  • Press R to restart without relaunching

Controls

Key Action
← / → Arrow Move bat
R Restart after game over
Esc Quit

Prerequisites

Tool Version
C++ compiler GCC 9+ / Clang 10+ / MSVC 2019+
CMake 3.16+
SFML 2.5.x

Install SFML

Ubuntu / Debian

sudo apt install libsfml-dev

macOS (Homebrew)

brew install sfml

Windows
Download the pre-built binaries from sfml-dev.org and set SFML_DIR in CMake.

Build

git clone https://github.com/AKumarOfficial/pong.git
cd pong
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

The binary is placed in build/ alongside the font/ folder.

Run

./build/Pong          # Linux / macOS
build\Pong.exe        # Windows

Project Structure

pong/
├── include/
│   ├── Ball.h          # Ball declarations
│   ├── Bat.h           # Bat declarations
│   ├── Constants.h     # All tunable game constants
│   └── GameState.h     # GameState enum
├── src/
│   ├── Ball.cpp
│   ├── Bat.cpp
│   └── main.cpp        # Game loop & entry point
├── font/
│   └── KOMIKAP_.ttf
├── CMakeLists.txt
├── .gitignore
└── README.md

Configuration

All gameplay constants (window size, speeds, ball radius, lives, etc.) live in include/Constants.h. Adjust them there without touching game logic.

License

MIT — see LICENSE for details.

About

A classic single-player Pong game built with C++17 and SFML. Features smooth bat movement, lives system, score tracking, and game-over screen.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors