This project implements a simple Pong game using C++ and the SDL2 library. The game consists of a ball and two paddles, and the objective is to score points by hitting the ball past the opponent's paddle.
To build the project, follow these steps:
- Make sure
SDL2andCMAKEis installed on your system.
sudo pacman -S sdl2 cmake- Create a build directory and build the project
make
mkdir build
cd build
cmake ..
makeAfter building the project, run the executable:
./pongThis will generate the "pong" executable in the build directory.
-
Player 1:
- Move Up: W
- Move Down: S
-
Player 2:
- Move Up: I
- Move Down: K
-
Quit:
- Q
The project is organized into three main classes:
-
Ball Class (
ball.h): Represents the ball in the Pong game. -
Paddle Class (
paddle.h): Represents a paddle in the Pong game. -
Game Manager Class (
main.cpp): Manages the game state, input, rendering, and logic.
This project is licensed under the MIT License.
Special thanks to the SDL2 development team for their contributions to the gaming community.
Enjoy playing Pong!