egui support
- 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
This commit is contained in:
parent
e88ce258ce
commit
ce24354f3b
18 changed files with 806 additions and 204 deletions
22
core/src/egui_queue.rs
Normal file
22
core/src/egui_queue.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue