Installing and integrating Box2D
To be able to work with 2D physics, one great open source physics engine is Box2D. This comes with lots of functions that are common for any 2D game built in, so we do not have to reinvent the wheel and write them again.
Getting ready
You need to have a working Windows machine.
How to do it…
Go through the following steps:
Go to http://box2d.org/.
Browse to http://box2d.org/downloads/.
Download or clone the latest copy from GitHub.
Build the solution in your version of Visual Studio. Some projects may not work, as they were built in different versions of Visual Studio.
If this throws an error, clean the solution, delete the
bin
folder, and rebuild it.After the solution rebuilds successfully, run the
TestBed
projects.If you can run the application successfully, Box2D has been integrated.
How it works…
Box2D is a physics engine built entirely in C++. As it has given us access to the source code, it means we can build it from scratch as well, and check for ourselves...