[][src]Module imgui_ext::button

button(...) docs.

button(...) places a button on the UI.

Fields

  • label button name.

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; 2] {
    [100.0, 20.0]
}

let mut buttons = Button { count: 0 };

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

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

]image