A 2d physics engine in C++