News Mar 20: R.U.B.E v1.7 released. Instanciable objects!
Feb 21: Added RUBE sample loader for Cocos2d-X v3.4.
Feb 17: Funny Fists released in iOS App store and Google Play store. (YouTube video)
2014
May 25: R.U.B.E v1.6 released. Samplers!
May 12: "On-the-fly" resource updating for Cocos2d-x
Apr 22: New blog post: Inverted pendulum control
Apr 7: On-screen logging class for Cocos2d-x
Mar 22: Downhill Supreme 2 released for iOS and Android
Jan 2: YouTube video: Making soft-body wheels in RUBE
2013
Oct 6: Check out Supplyfront RTS, my 7dRTS entry continued.
Sep 26: R.U.B.E v1.5 released. Customizable item labels, snap-to-grid, export filtering, full-text help search.
Sep 18: Added RUBE sample loader for Cocos2d-X.
Sep 16: Updated RUBE sample loader for Cocos2d v2.
Aug 12: RUBE loader for Nape by Zeh Fernando
Aug 7: Added RUBE sample loader for SFML.
Jul 30: Try my MiniLD 7dRTS entry.
Jul 24: Added physics-driven particles tutorial.
Jul 20: New blog post: rendering solid ground (as in Downhill Supreme)
Jul 18: R.U.B.E v1.4 released. Command-line interface for batch jobs, hotkeys for scripts, better script management.
May 22: Downhill Supreme is out now! (iOS)
Apr 2: R.U.B.E v1.3 released. Collision bitplane editing, Cocos2d-iphone loader, usability improvements.
Mar 11: R.U.B.E v1.2 released. Now supports weld, friction, motor joints and automatic image reloading.
Mar 10: RUBE loader for libGDX by Tim Scott
Jan 28: New blog post: a functional combustion engine!
Jan 22: New blog post: wind tunnel
Jan 20: Added explosions tutorial.
Jan 16: Added buoyancy tutorial.
Jan 16: AndEngine sample project to load RUBE scene by Bart Hirst
Jan 14: R.U.B.E v1.1 released, now supports custom properties.
Jan 1: All basic tutorials are now available in Chinese at ohcoder.com Huge thankyou to @OhCoder!
2012
Dec 23: Discussion forums have been set up
Dec 4: R.U.B.E v1.0 is ready !
Dec 2: YouTube video: Box2D pendulum clock
Nov 26: New blog post: rocket platform thingy
Nov 25: Video of R.U.B.E scenes in Chipmunk.
Nov 23: A sample project to load R.U.B.E scenes into Chipmunk physics! Details here.
Nov 14: An XCode sample project to load R.U.B.E scenes on iOS is now available. Details here.
Nov 11: A Java version of b2dJson is now available, based on JBox2D.
Nov 6: A Javascript version of b2dJson based on box2dweb is now available. Demo here!
Nov 2: The full specification of the JSON format used by b2dJson can be found here: b2dJson file structure
Oct 28: YouTube video: 2-minute ragdoll in R.U.B.E Box2D editor
Sep 29: YouTube video: R.U.B.E Box2D editor usage example

Box2D C++ tutorials - Setting up (Windows)

Last edited: July 14 2013

Building the testbed (Windows)


Let's look at the process of setting up the default 'testbed' which is part of the Box2d source code base. The testbed is a very useful tool which contains examples of various features which you can interact with using the mouse, adjust parameters, pause and step the simulation etc.

Here I am installing on WindowsXP, using the free IDE Code::Blocks and the free c++ compiler MinGW.

The simplest way to build the Box2D library is to use the Code::Blocks project file which is included in the source code download. You can get Code::Blocks and the MinGW compiler together in one easy to install package from here. The first time you use Code::Blocks you will need to confirm that you are using the GNU gcc compiler.

Download the Box2D source code archive from here and unzip it. In the Contributions/Platforms/CodeBlocks folder, you will find a file called Box2D.workspace which can be opened with Code::Blocks. Unfortunately in the download file, the project files seem to be out of sync and the filepaths were not matching with the folder structure of the rest of the source. I fixed the project files so that the paths match, you can download them here. Please use these to replace the .workspace and .cbp files in the Codeblocks folder.
Box2D v2.1.2 Code::blocks project files

* Update: Box2D v2.2.0 has been released.
The tutorials on this site are using v2.1.2 but I will put the v2.2.0 project files here for those who might be looking for them.
Box2D v2.2.0 Code::blocks project files


Open the Box2D.workspace file with Code::Blocks and select 'Build and run' from the main menu. If everything works out you should see the testbed window showing like this:
Testbed Select from the drop-down list in the top right to try out the tests that are currently in the testbed. We will be adding our own items into this list later on.

Testbed features


Apart from the obvious features visible in the right hand control panel, the testbed also allows you to:
  • Move the view around - arrow keys or drag with right mouse button
  • Zoom the view - z,x keys
  • Grab objects in the scene - left mouse button
  • Launch a bullet into the scene from a random location - space bar
  • Launch a bullet into the scene - drag left mouse button while holding shift, then let go
Depending on which test you view, you can sometimes use the keyboard to interact with the scene too. We will make use of the mouse and keyboard interactions in these tutorials.


Not seeing the any comments below? Try changing the 'https' in the page URL to just 'http'
Click here: http://www.iforce2d.net/b2dtut/setup-windows