From c1adf64c1aaecd5a2b9d532d707ef35971f1aa18 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Thu, 7 May 2026 08:50:05 -0400 Subject: begin work on body info window --- src/ui/fleet_window.rs | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/ui/fleet_window.rs (limited to 'src/ui/fleet_window.rs') diff --git a/src/ui/fleet_window.rs b/src/ui/fleet_window.rs new file mode 100644 index 0000000..67a0dd9 --- /dev/null +++ b/src/ui/fleet_window.rs @@ -0,0 +1,80 @@ +use std::cell::RefCell; + +use crate::{GameState, eguictx::EguiCtx, solar_system::{self, SolarSystem, fleet::Fleet}, ui}; + + +#[derive(Default, Clone)] +pub struct FleetWindowState +{ + +} + +#[derive(Default, Clone)] +pub struct FleetWindowAction +{ + +} + +impl FleetWindowState +{ + pub fn render( + &mut self, + game_state: &GameState, + eguictx: &EguiCtx) + -> FleetWindowAction + { + let mut action = FleetWindowAction::default(); + + let star_systems = game_state.solar_systems(); + + egui::Window::new("Fleet Manager") + .show(eguictx.context(), |ui| { + + ui.horizontal(|ui| { + self.paint_systems_list(star_systems, ui); + ui.add(egui::Separator::default().vertical()); + }); + }); + action + } + + fn paint_systems_list( + &mut self, + star_systems: &[SolarSystem], + ui: &mut egui::Ui) + -> egui::InnerResponse<()> + { + ui.vertical(|ui| { + for system in star_systems { + let resp = self.paint_fleet_list(&system, ui); + if resp.header_response.secondary_clicked() { + resp.header_response.context_menu(|ui| { + + }); + } + } + }) + } + + fn paint_fleet_list( + &mut self, + star_system: &SolarSystem, + ui: &mut egui::Ui) + -> egui::CollapsingResponse<()> + { + let fleets = star_system.fleets(); + ui.collapsing(star_system.name(), |ui| { + for fleet in fleets { + self.paint_fleet_entry(fleet, ui); + } + }) + } + + fn paint_fleet_entry( + &mut self, + fleet: &Fleet, + ui: &mut egui::Ui) + { + ui.label(fleet.name()); + } +} -- cgit v1.2.3