https://github.com/germangb/imgui-ext
Rust library for building imgui GUIs using a derive macro
https://github.com/germangb/imgui-ext
graphics imgui rust ui
Last synced: 3 months ago
JSON representation
Rust library for building imgui GUIs using a derive macro
- Host: GitHub
- URL: https://github.com/germangb/imgui-ext
- Owner: germangb
- License: mit
- Created: 2019-01-28T00:03:20.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-04-28T21:43:02.000Z (about 5 years ago)
- Last Synced: 2025-12-29T10:50:50.187Z (6 months ago)
- Topics: graphics, imgui, rust, ui
- Language: Rust
- Homepage: https://crates.io/crates/imgui-ext
- Size: 6.94 MB
- Stars: 94
- Watchers: 1
- Forks: 2
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this 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](https://crates.io/crates/imgui-inspect-derive), which looks neat!
# imgui-ext
[](https://travis-ci.org/germangb/imgui-ext)
[](https://crates.io/crates/imgui-ext)
[](https://docs.rs/imgui-ext)
[](https://germangb.github.io/imgui-ext/)
A derive-macro for [imgui](https://crates.io/crates/imgui).
```rust
#[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
```bash
# codegen example (see examples/codegen.rs to see the macro expansion)
cargo run --example codegen
# integration with nalgebra types
cargo run --example nalgebra
```
[result]: assets/demo.png
## Limitations
* `#[derive(imgui_ext::Gui)]` is only supported for `struct`s with named fields.
## License
[MIT](LICENSE.md)