JavaCPP Presets for LiquidFun


This directory contains the JavaCPP Presets module for:

Please refer to the parent file for more detailed information about the JavaCPP Presets.


Java API documentation is available here:

Sample Usage

Here is a simple example of LiquidFun ported to Java.

We can use Maven 3 to download and install automatically all the class files as well as the native binaries. To run this sample code, after creating the pom.xml and src/main/java/ source files below, simply execute on the command line:

 $ mvn compile exec:java

The pom.xml build file


The src/main/java/ source file

import org.bytedeco.javacpp.*;
import static org.bytedeco.javacpp.liquidfun.*;

public class Example {
  public static void main(String[] args) {
    b2World w = new b2World(0.0f, -10.0f);
    b2BodyDef bd = new b2BodyDef();
    bd.SetPosition(1.0f, 5.0f);
    b2CircleShape c = new b2CircleShape();
    b2FixtureDef fd = new b2FixtureDef();
    b2Body b = w.CreateBody(bd);
    for (int i = 1; i <= 5; i++) {
      System.out.println(i + ": ball at " + b.GetPositionX() + "," + b.GetPositionY());
      w.Step(0.1f, 2, 8);