LiquidFun Rust
Rust bindings for LiquidFun.
- Model LiquidFun C++ API as closely as possible.
- Documentation for C++ API should be usable for Rust API.
- Document places where Rust API varries from C++ API.
Usage
First, add the following to your Cargo.toml:
[]
= "*"
Next, add this to your crate root:
extern crate liquidfun;
Example
extern crate liquidfun;
use *;
use *;
Status
The LiquidFun Hello World example compiles and runs. More bindings will be added as needed by projects that depend on LiquidFun Rust.
Passing structs by value from C++ to Rust
- make a new typedef struct with same name as C++ struct but with
c_prefix - add just the data parts from the C++ struct, make sure both struct members have the same order
// C++
;
// new C struct
typedef struct c_b2Vec2 c_b2Vec2;
- make a casting function
- cast C++ struct to new C struct and pass back to rust
c_b2Vec2*
c_b2Vec2
Thank You
Erin Catto for Box2D
Google for LiquidFun
Nicolas Silva for box2d.rs