A 2D physics engine in ANSI C.
mkdir build
cd build
cmake ..
make -j
TheBox [simulation file]
Simulation files control the behaviour of the program. The repository contains a simple simulation example in simulation.txt.
The syntax is as follows:
simulation [nobj] [timestep] [gravity]
: Creates a simulation withnobj
objects, sets the gravity togravity
and the time interval between frames astimestep
.window [width] [height] [bpp] [scale] [quality]
: Creates a window of sizewidth
xheight
andbpp
bits per pixel, sets the view scale toscale
and rendering quality toquality
(between 5 and 100).shape [restitution] [friction] box [half width] [half height]
: Creates a box with size 2*half width
x2*half height
, and sets itsfriction
andrestitution
.shape [restitution] [friction] circle [radius]
: Creates a circle with radiusradius
, and sets itsfriction
andrestitution
.object [shape index] [flags] [mass] [x] [y] [angle] ([x speed] [y speed] [angular velocity])
: Creates an object with the shape indexed byshape index
(starting from 0), the given flags (STATIC=1, SLEEPING=2),mass
,position
, andvelocity
.