mgerhardy/caveexpress

Add support for box2d 2.4+

akien-mga opened this issue · 3 comments

Hi,

Box2D had a new 2.4.0 (and then 2.4.1) release recently, which breaks compatibility with earlier releases:

  • Files have been renamed to use snake_case and are now packaged in a box2d (lowercase) directory:
/usr/include/box2d/b2_api.h
/usr/include/box2d/b2_block_allocator.h
/usr/include/box2d/b2_body.h
/usr/include/box2d/b2_broad_phase.h
/usr/include/box2d/b2_chain_shape.h
/usr/include/box2d/b2_circle_shape.h
/usr/include/box2d/b2_collision.h
/usr/include/box2d/b2_common.h
/usr/include/box2d/b2_contact.h
/usr/include/box2d/b2_contact_manager.h
/usr/include/box2d/b2_distance.h
/usr/include/box2d/b2_distance_joint.h
/usr/include/box2d/b2_draw.h
/usr/include/box2d/b2_dynamic_tree.h
/usr/include/box2d/b2_edge_shape.h
/usr/include/box2d/b2_fixture.h
/usr/include/box2d/b2_friction_joint.h
/usr/include/box2d/b2_gear_joint.h
/usr/include/box2d/b2_growable_stack.h
/usr/include/box2d/b2_joint.h
/usr/include/box2d/b2_math.h
/usr/include/box2d/b2_motor_joint.h
/usr/include/box2d/b2_mouse_joint.h
/usr/include/box2d/b2_polygon_shape.h
/usr/include/box2d/b2_prismatic_joint.h
/usr/include/box2d/b2_pulley_joint.h
/usr/include/box2d/b2_revolute_joint.h
/usr/include/box2d/b2_rope.h
/usr/include/box2d/b2_settings.h
/usr/include/box2d/b2_shape.h
/usr/include/box2d/b2_stack_allocator.h
/usr/include/box2d/b2_time_of_impact.h
/usr/include/box2d/b2_time_step.h
/usr/include/box2d/b2_timer.h
/usr/include/box2d/b2_types.h
/usr/include/box2d/b2_weld_joint.h
/usr/include/box2d/b2_wheel_joint.h
/usr/include/box2d/b2_world.h
/usr/include/box2d/b2_world_callbacks.h
/usr/include/box2d/box2d.h
  • float32 and float64 were removed

  • Apparently more changes as after patching caveexpress code to account for the above two, I still had errors and gave up on doing the port myself (for now).

To keep this codebase future proof it would be great to update to latest box2d (both builtin code and compatibility with system libraries, as I guess it would be tricky to keep support for both 2.4.x and 2.3.x).

Working on it - most of the stuff is already done and pushed to the master branch. But there is a problem left with the revolute joint. Will figure it out in the next few days.

Ok, the player-not-moving issue is fixed now - thanks to Eric Catto who found it.
The problem was, that I did not set a density to the circle body in Player::createBody(). And box2d 2.4 changed the behavior of zero density objects to mto make them behave like static bodies.

There is another problem left with the packages not pulled into the target. But I'll open another ticket for that one. As the update is done and the game is playable like it is now.