diff options
Diffstat (limited to 'src/window')
| -rw-r--r-- | src/window/ui.rs | 40 |
1 files changed, 32 insertions, 8 deletions
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<solar_system::SystemId>, pub camera_scale: f32, + pub camera_pos: Option<cgmath::Point3<f32>>, pub camera_target: Option<solar_system::BodyId>, pub auto_time: Option<Second>, 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| { |
