- New Resource, EguiQueue: Utility to queue egui ui builders - New Rendering System, EguiRenderer: Utilizes a modified egui_glium library to render egui UI - Adjusted RenderingSystem trait and RenderingContext structure to provide event_loop and egui_queue. - Various minor adjusments
22 lines
522 B
Rust
22 lines
522 B
Rust
pub struct EguiQueue {
|
|
pub queue_vec: Vec<Box<dyn FnOnce(&egui::Context) + Send>>,
|
|
}
|
|
|
|
impl EguiQueue {
|
|
pub fn new() -> Self {
|
|
Self { queue_vec: Vec::new() }
|
|
}
|
|
|
|
pub fn queue(&mut self, func: impl FnOnce(&egui::Context) + Send + 'static) {
|
|
self.queue_vec.push(Box::new(func));
|
|
}
|
|
|
|
pub fn clear(&mut self) {
|
|
self.queue_vec.clear()
|
|
}
|
|
|
|
pub fn run(&mut self, ctx: &egui::Context) {
|
|
self.queue_vec.drain(..).for_each(|func| func(ctx));
|
|
self.clear();
|
|
}
|
|
}
|