Skip to content
modkitv0.2

box2d.h

#include <modkit/box2d.h>3 functions · 1 structs · 1 typedefs

Optional Box2D 3.1.1 interpolation and Canvas debug-draw bridge.

Functions

mk_box2d_debug_drawfunction

bool mk_box2d_debug_draw(b2WorldId world, mk_canvas_t canvas, float screen_scale, const mk_box2d_debug_draw_desc *desc)

Draw authoritative Box2D state into an already-active Canvas.

ParameterTypeDescription
worldb2WorldIdValue for world.
canvasmk_canvas_tValue for canvas.
screen_scalefloatValue for screen scale.
descconst mk_box2d_debug_draw_desc *Configuration descriptor.

Returns True when the operation succeeds.

mk_box2d_debug_draw_desc_defaultfunction

mk_box2d_debug_draw_desc mk_box2d_debug_draw_desc_default(void)

Draw desc default for the box2d debug.

Returns The resulting value.

mk_box2d_transform_lerpfunction

b2Transform mk_box2d_transform_lerp(b2Transform previous, b2Transform current, float alpha)

Interpolate a Box2D transform for rendering.

ParameterTypeDescription
previousb2TransformValue for previous.
currentb2TransformValue for current.
alphafloatValue for alpha.

Returns The resulting value.

Structs

mk_box2d_debug_draw_descstruct

Data for box2d debug draw desc.

FieldTypeDescription
line_width_pxfloatThe line width px.
fill_alphafloatThe fill alpha.
draw_shapesboolThe draw shapes.
draw_jointsboolThe draw joints.
draw_joint_extrasboolThe draw joint extras.
draw_boundsboolThe draw bounds.
draw_massboolThe draw mass.
draw_body_namesboolThe draw body names.
draw_contactsboolThe draw contacts.
draw_graph_colorsboolThe draw graph colors.
draw_contact_normalsboolThe draw contact normals.
draw_contact_impulsesboolThe draw contact impulses.
draw_contact_featuresboolThe draw contact features.
draw_friction_impulsesboolThe draw friction impulses.
draw_islandsboolThe draw islands.

Typedefs

mk_box2d_debug_draw_desctypedef

typedef struct mk_box2d_debug_draw_desc mk_box2d_debug_draw_desc

Data for box2d debug draw desc.