10 releases

0.3.1 Jan 6, 2022
0.3.0 Sep 10, 2021
0.2.3 Apr 24, 2021
0.2.2 Mar 26, 2021
0.1.0 Nov 20, 2020

#915 in Graphics APIs

Download history 10/week @ 2024-09-22 12/week @ 2024-09-29

58 downloads per month
Used in rokol

MIT license

525KB
10K SLoC

Rust 9K SLoC // 0.0% comments Python 1.5K SLoC // 0.2% comments C 23 SLoC // 0.3% comments Objective-C 16 SLoC // 0.3% comments

rokol-ffi

Rust FFI to Sokol, only for Rokol

It's generated with bindgen and implements Default trait.

Status

Tested on macOS only

Supported headers

rokol_ffi compiles all of the follows:

  • sokol_app.h
  • sokol_gfx.h
  • sokol_glue.h

Supported backends

GlCore33, Metal and D3D9. WebGPU backend is not supported by rokol-ffi (until I need it).

Specifying renderer

Use feature flag to switch graphics backend: cargo run --features=glcore33.

Conditional compilation in down stream crates

rokol_ffi/build.rs emits DEP_SOKOL_GFX to build.rs of crates that lists rokol_ffi in their Cargo.toml.

c.f. Build Scripts - The Cargo Book #The links Manifest Key


lib.rs:

Rust FFI to Sokol headers for Rokol (API)

Last update: Dec 3, 2020 (commit). Sokol header declaration diffs can be seen on GitHub.

impl Default

Generated with bindgen, implementing Default trait (Bindgen::derive_default(true)).

NOTE: Sokol considers zero-initizialized structures to be in default state. It means Default::default is ensured to make sense!

FFI to sokol_glue.h

Dependencies

~0–2.2MB
~43K SLoC