Imgui Ext Save

Rust library for building imgui GUIs using a derive macro

Project README

⚠️ imgui-ext needs a full rewrite. Since it was my first attempt at making a procedural macro, it has grown messy and difficult to maintain due to lack of planning. Until the rewrite happens, use with caution.

You can also check out imgui-inspect-derive, which looks neat!

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

Open Source Agenda is not affiliated with "Imgui Ext" Project. README Source: germangb/imgui-ext
Stars
94
Open Issues
11
Last Commit
2 years ago
Repository
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating