Well, strange question, I'm using egui
and macroquad
, showing LogsWindow
over CentralWindow
. But I just can't close it using click on the cross (.open()
method for Window
object).
pub struct LogsWindow<'a> {
pub is_opened: &'a mut bool,
pub logs: Logs,
}
impl<'a> LogsWindow<'a> {
pub fn new(logs: Logs, is_opened: &'a mut bool) -> Self {
Self { is_opened, logs }
}
pub fn name(&self) -> &'static str {
"Logs"
}
pub fn show(&mut self, ctx: &egui::Context) {
egui::Window::new(self.name())
.open(self.is_opened)
.show(ctx, |_| {});
}
pub fn ui(&mut self, ui: &mut Ui) {
egui::Grid::new("logs_grid").striped(true).show(ui, |ui| {
------smth-----
});
}
}
And for UI:
egui_macroquad::ui(|egui_ctx| {
LogsWindow::new(logs.clone(), &mut true).show(egui_ctx);
egui::CentralPanel::default()
.frame(Frame::none().fill(Color32::TRANSPARENT))
.show(egui_ctx, |central_panel_ui| {
------------smth more-----------------
});
});
egui_macroquad::draw();
I understand that egui
is in immediate mode UI and therefore draws each frame creating new LogsWindow with .open(true), but I don't know how to actually make it work