Sunday, September 12, 2010

Box2D with SFML Test #2: Arch

I made another test project, built on the first one. This time I used the polar equation of an ellipse to draw a self-supported arch out of polygon blocks. Math is fun :) . Movement and rotation of the main square are the same, though I took out the gravity changes and random forces for simplicity:



Downloads:
windows exe/binary
source code/project

Update to Test #1

I updated the source code for the first SFML+Box2D test. Now everything is organized in a nice C++-style object-oriented fashion, instead of just lumped into one file with lots of function calls like before. I also made it so changing the gravity "wakes up" sleeping objects (idle blocks/circles that have turned a gray color), forcing them to move with the rest. Here it is:

windows exe/binary
source code/project

Sunday, September 5, 2010

Box2D with SFML Test #1

I've just started learning about the joys of Box2D physics, using the SFML library for graphics and windowing. I started this blog to share some fun tests and projects with source code for examples. All code is in C++, compiled with Visual C++ 2008 Express (though I may switch to the 2010 version someday).

My first test project is a simple one... move a box around and bonk into some stuff:


Download and play with it here:
windows exe/binary
source code/project

(note that the exe was built with the Multi-threaded DLL (/MD) runtime library option, so you will need to have the C++ standard library dlls on your computer, available here if you don't have them already)