[][src]Module imgui_ext::button

button(...) docs.

button(...) is not associated to any particular type, but its position within an annotation will determine where it is rendered in the final UI.

Fields

  • label

Optional fields

  • size path to a function that returns the button size.
  • catch

Example

use imgui_ext::UiExt;

#[derive(imgui_ext::Gui)]
struct Button {
    #[imgui(
        button(size = "button_size", label = "Click me!", catch = "click"),
        separator,
        display(label = "Clicks")
    )]
    count: i32,
}

const fn button_size() -> (f32, f32) {
    (100.0, 20.0)
}

let mut buttons = Button { count: 0 };

let events = ui.draw_gui(&mut buttons);

if events.click() {
    buttons.count += 1;
}

]image