egui: put debug visualization checkboxes in a dropdown menu

This commit is contained in:
Mikolaj Wielgus 2024-07-21 13:59:08 +02:00
parent 4e064439f9
commit 0552dd3f33
2 changed files with 25 additions and 18 deletions

View File

@ -23,6 +23,7 @@ pub struct Top {
pub show_ratsnest: bool, pub show_ratsnest: bool,
pub show_navmesh: bool, pub show_navmesh: bool,
pub show_bboxes: bool, pub show_bboxes: bool,
pub show_origin_destination: bool,
} }
impl Top { impl Top {
@ -32,6 +33,7 @@ impl Top {
show_ratsnest: false, show_ratsnest: false,
show_navmesh: false, show_navmesh: false,
show_bboxes: false, show_bboxes: false,
show_origin_destination: false,
} }
} }
@ -109,9 +111,12 @@ impl Top {
ui.separator(); ui.separator();
ui.toggle_value(&mut self.show_ratsnest, "Show Ratsnest"); ui.menu_button("Debug", |ui| {
ui.toggle_value(&mut self.show_navmesh, "Show Navmesh"); ui.checkbox(&mut self.show_ratsnest, "Show Ratsnest");
ui.toggle_value(&mut self.show_bboxes, "Show Bboxes"); ui.checkbox(&mut self.show_navmesh, "Show Navmesh");
ui.checkbox(&mut self.show_bboxes, "Show BBoxes");
ui.checkbox(&mut self.show_origin_destination, "Show OriginDestination");
});
ui.separator(); ui.separator();

View File

@ -230,6 +230,7 @@ impl Viewport {
} }
if let Some(navmesh) = execute.maybe_navmesh() { if let Some(navmesh) = execute.maybe_navmesh() {
if top.show_origin_destination {
if let (origin, destination) = (navmesh.origin(), navmesh.destination()) { if let (origin, destination) = (navmesh.origin(), navmesh.destination()) {
painter.paint_dot( painter.paint_dot(
Circle { Circle {
@ -250,6 +251,7 @@ impl Viewport {
} }
} }
} }
}
viewport_rect viewport_rect
}) })