pub enum UICommand { Text(String), Separator, } pub struct DebugUIBuffer { cmds: Vec, } impl DebugUIBuffer { pub fn new() -> DebugUIBuffer { DebugUIBuffer { cmds: vec![] } } // Commands pub fn text(&mut self, text: String) { self.cmds.push(UICommand::Text(text)); } pub fn separator(&mut self) { self.cmds.push(UICommand::Separator); } pub fn write_buffer(&self, ui: &imgui::Ui) { for cmd in &self.cmds { match cmd { UICommand::Text(s) => { ui.text(s); } UICommand::Separator => { ui.separator(); } } } } pub fn reset_buffer(&mut self) { self.cmds = vec![]; } }