wip: Changes of the week

- Move engine to a different crate
- Add engine trait
- Refactor the rest of the codebase to work with these changes
- Add debug ui buffer, use it to finish imgui support
This commit is contained in:
reo 2025-09-07 17:00:04 +03:00
parent 3fd5b09a94
commit 15122b8ebd
20 changed files with 344 additions and 117 deletions

40
core/src/debug_ui.rs Normal file
View file

@ -0,0 +1,40 @@
pub enum UICommand {
Text(String),
Separator,
}
pub struct DebugUIBuffer {
cmds: Vec<UICommand>,
}
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![];
}
}