imgui-ext 0.2.0

A crate to build debug UIs on structs using a derive macro (based on the imgui crate)
Documentation

imgui-ext¹

Build Status Cargo package docs.rs docs Master docs

A crate to quickly build imgui UIs using annotations and a derive macro.

¹ The name imgui-ext follows the convention of adding an -Ext suffix to something that enhances an existing type. In this case, the imgui crate.

use imgui_ext::UiExt;

#[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,
}

ui.window(im_str!("README.md"))
    .size((300.0, 100.0), ImGuiCond::FirstUseEver)
    .build(|| {
        ui.draw_gui(&mut example);
    });

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