imgui-ext
imgui-ext copied to clipboard
Sensible default widgets
At the moment, the default widget is a label, which means that if you don't specify a widget type inside an annotation, that particular struct field is rendered as a text label (provided it implements Display
), which is not interactive.
The idea is to define the following default widgets for each type:
rust type | default widget | remarks |
---|---|---|
i32 , u32 , f32 , [f32; 2] , (f32, f32) etc... |
input | |
bool |
checkbox | |
String , ImString |
input | String might need an extra allocation, which is not desirable |
NOTE: Table not definitive
This way you can save a few keystrokes:
#[derive(imgui_ext::Gui)]
struct Example {
#[imgui(checkbox)]
a: bool,
#[imgui(input)]
b: [f32; 2],
}
// would become equivalent to:
#[derive(imgui_ext::Gui)]
struct Example {
#[imgui]
a: bool,
#[imgui]
b: [f32; 2],
}