2018-12-26 13:38:46 +00:00
|
|
|
use crate::gui::Gui;
|
2018-12-26 09:46:23 +00:00
|
|
|
|
2018-12-26 14:28:38 +00:00
|
|
|
#[derive(Default)]
|
2018-12-26 09:46:23 +00:00
|
|
|
pub struct App {
|
|
|
|
count: i32,
|
2018-12-26 16:01:46 +00:00
|
|
|
slider_value: f32,
|
2018-12-26 09:46:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl App {
|
|
|
|
pub fn show_gui(&mut self, gui: &mut Gui) {
|
|
|
|
if gui.button("Click me").clicked {
|
|
|
|
self.count += 1;
|
|
|
|
}
|
|
|
|
|
2018-12-26 16:01:46 +00:00
|
|
|
gui.label(format!("The button have been clicked {} times", self.count));
|
|
|
|
|
|
|
|
gui.slider_f32("Slider", &mut self.slider_value, 0.0, 10.0);
|
2018-12-26 09:46:23 +00:00
|
|
|
|
2018-12-26 14:28:38 +00:00
|
|
|
let commands_json = format!("{:#?}", gui.gui_commands());
|
|
|
|
gui.label(format!("All gui commands: {}", commands_json));
|
2018-12-26 09:46:23 +00:00
|
|
|
}
|
|
|
|
}
|