C++ single header 2D physics engine implementation. Simple to use and ideal for rendering, games, and other experimentation.
Usage...
During setup:
p2d::Physics physics;
p2d::CircleBody circleBody(radius, x, y, mass, restitution);
physics.add(&circleBody);
On every frame:
physics.update(dt);
P2D can be used with any renderer of your choice, however the included demos require SFML for graphics and sound. To run, simply create an instance of chosen demo as follows:
Planets planets;
Snooker snooker;
Playground playground;
Install CMake, e.g. for Debian/Ubuntu:
sudo apt-get install build-essential libssl-dev
sudo apt-get install cmake
Install SFML:
sudo apt-get install libsfml-dev
Clone repo and make a new directory called build
inside the src
directory and enter it.
cd {DOWNLOAD_LOCATION}/physics-2d/src
mkdir build
cd build
run CMake
cmake ../
run make
make
Start the game:
./Physics
Install CMake, use CMake GUI or command line to generate Visual Studio .sln file, then build with VS.