From 3dc92fad981e28c760f3c6e95f5a8153ea6c9be4 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Wed, 15 Apr 2026 22:22:45 -0400 Subject: work on orbits (not right yet), orbit camera --- src/window/ui.rs | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'src/window') diff --git a/src/window/ui.rs b/src/window/ui.rs index 4d13740..60cd795 100644 --- a/src/window/ui.rs +++ b/src/window/ui.rs @@ -9,6 +9,7 @@ pub struct GameWindowUiState { pub current_system: Option, pub camera_scale: f32, + pub camera_pos: Option>, pub camera_target: Option, pub auto_time: Option, pub do_auto_tick: bool @@ -39,22 +40,16 @@ impl GameWindowUiState egui::TopBottomPanel::top("topbar").show( eguictx.context(), |ui| { - - ui.horizontal(|ui| { - ui.menu_button("File", |ui| { - - }); - }); ui.horizontal(|ui| { let solar_systems = game_state.solar_systems(); - let selected_label = match state.current_system { + let selected_system_label = match state.current_system { Some(id) => solar_systems[id].name(), None => "" }; egui::ComboBox::from_label("Current System") - .selected_text(selected_label) + .selected_text(selected_system_label) .show_ui(ui, |ui| { for (i, system) in solar_systems.iter().enumerate() { @@ -65,6 +60,35 @@ impl GameWindowUiState ); } }); + + let current_system = match state.current_system { + Some(id) => &solar_systems[id], + None => return + }; + + let selected_body_label = match state.camera_target { + Some(id) => current_system.bodies()[id].name(), + None => "" + }; + + ui.separator(); + + egui::ComboBox::from_label("Camera Target") + .selected_text(selected_body_label) + .show_ui(ui, |ui| { + + for (i, body) in current_system.bodies().iter().enumerate() { + ui.selectable_value( + &mut state.camera_target, + Some(i), + body.name()); + } + }); + + match state.camera_pos { + Some(pos) => { ui.label(format!("Pos x{} y{} z{}", pos.x, pos.y, pos.z)); }, + None => {} + } }); ui.horizontal(|ui| { -- cgit v1.2.3