imgui-ext

Crates.ioimgui-ext
lib.rsimgui-ext
version0.3.0
sourcesrc
created_at2019-02-02 01:40:42.252401
updated_at2019-08-25 11:23:05.361257
descriptionA crate to build debug UIs on structs using a derive macro (based on the imgui crate)
homepage
repositoryhttps://github.com/germangb/imgui-ext
max_upload_size
id112094
size109,801
german gömez (germangb)

documentation

README

imgui-ext

Build Status Cargo package docs.rs docs Master docs

A derive-macro for imgui.

#[derive(imgui_ext::Gui)]
struct Example {
    #[imgui(slider(min = 0.0, max = 4.0))]
    x: f32,
    #[imgui(input(step = 2))]
    y: i32,
    #[imgui(drag(label = "Drag 2D"))]
    drag_2d: [f32; 2],
    #[imgui(checkbox(label = "Turbo mode"))]
    turbo: bool,
}

let mut example = Example { /* skipped */ };

ui.window(im_str!("Debug")).build(|| {
    use imgui_ext::UiExt;
    
    if ui.draw_gui(&mut example).turbo() {
        println!(
            "Turbo mode value changed: {}",
            example.turbo,
        );
    }
});

Examples

# codegen example (see examples/codegen.rs to see the code generated by the macro)
cargo run --example codegen

# several UI examples
cargo run --example ui

# integration with nalgebra types
cargo run --example nalgebra

Limitations

  • #[derive(imgui_ext::Gui)] is only supported for structs with named fields.

License

MIT

Commit count: 143

cargo fmt