egui/src/emgui.rs

22 lines
613 B
Rust
Raw Normal View History

2018-12-28 09:39:08 +00:00
use crate::{layout, style, types::*};
2018-12-26 22:08:50 +00:00
/// Encapsulates input, layout and painting for ease of use.
#[derive(Clone, Debug, Default)]
pub struct Emgui {
pub last_input: RawInput,
pub layout: layout::Layout,
pub style: style::Style,
}
impl Emgui {
pub fn new_frame(&mut self, new_input: RawInput) {
let gui_input = GuiInput::from_last_and_new(&self.last_input, &new_input);
self.last_input = new_input;
2018-12-28 09:39:08 +00:00
self.layout.new_frae(gui_input);
2018-12-26 22:08:50 +00:00
}
pub fn paint(&mut self) -> Vec<PaintCmd> {
style::into_paint_commands(self.layout.gui_commands(), &self.style)
}
}