#gui #imgui #macro

macro imgui-ext-derive

Procedural macro for the imgui-ext crate

16 releases

✓ Uses Rust 2018 edition

0.3.0 Aug 25, 2019
0.2.1 Jun 3, 2019
0.1.8 Apr 3, 2019
0.1.7 Mar 1, 2019
0.1.6 Feb 9, 2019

#190 in GUI

Download history 50/week @ 2019-11-01 4/week @ 2019-11-08 18/week @ 2019-11-15 33/week @ 2019-11-22 32/week @ 2019-11-29 116/week @ 2019-12-06 1/week @ 2019-12-13 16/week @ 2019-12-27 170/week @ 2020-01-10 99/week @ 2020-01-17 4/week @ 2020-01-24 3/week @ 2020-01-31 21/week @ 2020-02-07

142 downloads per month
Used in imgui-ext

MIT license

79KB
2K SLoC

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 */ };

imgui::Window::new(im_str!("debug")).build(ui, || {
    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 macro expansion)
cargo run --example codegen

# integration with nalgebra types
cargo run --example nalgebra

Limitations

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

License

MIT

Dependencies

~0.5–0.8MB
~19K SLoC