Skip to main content

just_box_2d 0.1.0 copy "just_box_2d: ^0.1.0" to clipboard
just_box_2d: ^0.1.0 copied to clipboard

Box2D v3.2 for Dart: a C layer of checked handles, batched reads, events, queries, character-mover queries and one-way platforms, built from source by a hook.

0.1.0 #

First release: Box2D for Dart, moved out of just_physics_engine 1.4.0 so other code can use it and the physics engine is plain Dart.

  • Box2D v3.2 (our fork of erincatto/box2d, a7a2e57) compiled from source by a two-stage build hook: a static box2d_core, linked into the bundled library package:just_box_2d/just_box_2d. Builds by default on every native platform and every Android ABI; an app turns it off with hooks: user_defines: just_box_2d: build: false.
  • Box2D (in package:just_box_2d/just_box_2d.dart, safe on the web): whether the library is in the build — one call up front, so a missing library is reported, not found mid-game — and its version (b2w_version). package:just_box_2d/ffi.dart adds the bindings.
  • The b2w_* C layer: worlds on their own thread pool at 100 units to the metre with min-restitution mixing; int64 handles carrying their world's generation, checked on every call; finalizers that only queue a destroy, performed on the next call from Dart; batched transform reads; contact, sensor and body-move events, and an impact callback from Box2D's hit events; ray and AABB queries; character-mover collide and cast queries; one-way platforms; circles, boxes, polygons of any vertex count (cut into convex pieces past 8), rounded polygons, capsules, segments and chains; revolute, prismatic, distance (rope, rod or spring), weld and wheel joints. Every function's rules and units are documented in box2d_wrapper.h and carried into the bindings' doc comments.
  • Only the b2w_* functions are exported: Box2D's own symbols, and the C++ runtime Android and Linux link in, stay hidden.
  • Web, compiled to JavaScript or to WebAssembly: package:just_box_2d/just_box_2d.dart compiles, and Box2D.isAvailable is false.
  • An example, example/example.dart: a ball dropped on a floor.
  • LICENSE carries Box2D's MIT text beside ours, in the form Flutter's licence page reads.
0
likes
160
points
84
downloads

Documentation

API reference

Publisher

verified publisherjustunknown.com

Weekly Downloads

Box2D v3.2 for Dart: a C layer of checked handles, batched reads, events, queries, character-mover queries and one-way platforms, built from source by a hook.

Repository (GitHub)
View/report issues

Topics

#physics #box2d #ffi #native-assets

License

BSD-3-Clause, MIT (license)

Dependencies

code_assets, hooks, native_toolchain_c

More

Packages that depend on just_box_2d