Old Atari game named "Pong" as test-task
Project was developed using MSVC 2019 and set of SDL libraries: SDL2, SDL_image, SDL_TTF.
The structure of the project is very simple.
In our main.cpp
we initialize GameManager
object and running game event loop.
GameManager
Object - controls all our entities such as players and ball, also handles game status and tell SDLScene
to render that scene that is needed by game state.
TextureLoader
loads all textures from "asset" folder and provides easy access for SDLScene
to get thom for rendering.
SDLScene
just gets all data from objects and render their positions.
Our entities (players and balls) controls their moves by them own. It's needed for simplifying controls and calculation logic as well as improve code readability.
Recommended tools: MSVC and Ninja
git clone https://github.com/Lerksy/Pong
.- Run x64 (or x86) Native Tools from MSVC Package
- Navigate to source folder
mkdir build && cd build
cmake -G Ninja ..
cmake --build . --config release
Run any IDE that supports CMake projects (CLion, QtCreator, MS Visual Studio, etc...)
And simply build project in IDE
WARNING This project uses C++20 standard. Be careful if you are using old compiler!
Use arrow up and arrow down for moving right platform and w
, s
for control left platform.