REM Demonstration of the Box2D (v2.2.1 or v2.3.1) Physics Engine REM by Richard Russell, http://www.rtrussell.co.uk/, 26-Jan-2013 MODE 8 : OFF INSTALL @lib$+"box2dlib" : PROC_b2Init INSTALL @lib$+"box2ddbg" ON ERROR PROCcleanup : IF ERR=17 CHAIN @lib$+"../examples/tools/touchide" ELSE ERROR 0,REPORT$+" at line "+STR$ERL ON CLOSE PROCcleanup : QUIT gravity_x = 0.0 gravity_y = -9.8 myWorld%% = FN_b2CreateWorld(gravity_x, gravity_y) PROC_b2DebugInit(myWorld%%, %01011, 100) pivot%% = FN_b2StaticBox(myWorld%%, 3.2, 4.5, 0.0, 0.1, 0.1) bob%% = FN_b2DynamicBody(myWorld%%, 5.0, 2.0, 0, 0, 0, 0, 0, 0) mass%% = FN_b2CircleFixture(bob%%, 0.0, 0.0, 0.235, 0.3, 0.7, 1.0) joint%% = FN_b2FrictionJoint(myWorld%%, pivot%%, bob%%, 3.2, 4.5, 2.0, 0.0) timeStep = 1.0/60.0 velIterations% = 8 posIterations% = 3 *REFRESH OFF REPEAT CLS PROC_b2WorldStep(myWorld%%, timeStep, velIterations%, posIterations%) PROC_b2DebugDraw(myWorld%%) *REFRESH WAIT 2 IF INKEY(-1) PROC_b2DebugFlags(4, 0) ELSE PROC_b2DebugFlags(4, 4) UNTIL FALSE PROCcleanup END DEF PROCcleanup myWorld%% += 0 : IF myWorld%% PROC_b2DestroyWorld(myWorld%%) : myWorld%% = 0 PROC_b2Exit ENDPROC