This project contains java bindings for the v3 release of Box2D.
The project is build from commit c7ce16a072173c3c19e8107838b90b419456459d.
The current version is: 0.1-SNAPSHOT
gdx-box2d provides the following artifacts:
com.badlogicgames.gdx:gdx-box2d:$version
com.badlogicgames.gdx:gdx-box2d-platform:$version:natives-desktop
com.badlogicgames.gdx:gdx-box2d-platform:$version:natives-ios
com.badlogicgames.gdx:gdx-box2d-platform:$version:natives-arm64-v8a
com.badlogicgames.gdx:gdx-box2d-platform:$version:natives-armeabi-v7a
com.badlogicgames.gdx:gdx-box2d-platform:$version:natives-x86
com.badlogicgames.gdx:gdx-box2d-platform:$version:natives-x86_64
Additionally, the following utility artifact is provided:
com.badlogicgames.gdx:gdx-box2d-utils:$version
At first, you need to call com.badlogic.gdx.box2d.Box2d#initialize
. This will load the shared libraries and set up the native code.
After that, com.badlogic.gdx.box2d.Box2d
provides all entry points into Box2D.
Closures can be allocated with ClosureObject#fromClosure
.
Structs and Pointer are part of the java GC cycle. If a struct/pointer gets allocated in java, it will be freed once the GC collects the java object.
All pointer types provide constructors to make them not freed by GC. You need to free those manually.
Closures always need to be freed manually.
If a box2d method returns a pointer, it will not be registered for GC.
The project needs java 8 language features to build. However, it doesn't use any java 8 APIs and is therefor still safe to use with mobiVM.
The following changes have been applied that are more than sole bindings:
- On initialization a custom routine for assertion handling gets installed. This will throw the assertion as an
Box2DAssertionError
.
The behaviour can be overwritten withb2SetAssertFcn
, see the box2d docs for more infos.
Windows:
- i686
- x86_64
MacOS:
- x86_64
- arm64
Linux:
- arm
- arm64
- x86_64
- riscv64
iOS:
- arm64 iphoneos
- arm64 iphonesimulator
- x86_64 iphonesimulator
Android:
- arm64-v8a
- armeabi-v7a
- x86
- x86_64