diff options
| author | Jon Santmyer <jon@jonsantmyer.com> | 2026-04-22 10:51:13 -0400 |
|---|---|---|
| committer | Jon Santmyer <jon@jonsantmyer.com> | 2026-04-22 10:51:13 -0400 |
| commit | 3d3864171785c589872bf23faaaa3a421f56ee4e (patch) | |
| tree | 4c4a927473ee1a58f23fff1e8ece8327a31d719a /src/window.rs | |
| parent | 3dc92fad981e28c760f3c6e95f5a8153ea6c9be4 (diff) | |
| download | systemic4x-3d3864171785c589872bf23faaaa3a421f56ee4e.tar.gz systemic4x-3d3864171785c589872bf23faaaa3a421f56ee4e.tar.bz2 systemic4x-3d3864171785c589872bf23faaaa3a421f56ee4e.zip | |
complete orbit camera. add most large solar bodies
Diffstat (limited to 'src/window.rs')
| -rw-r--r-- | src/window.rs | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/window.rs b/src/window.rs index 0be88e7..28c69f8 100644 --- a/src/window.rs +++ b/src/window.rs @@ -1,9 +1,3 @@ -pub mod ui; - -mod window { - pub use super::ui; -} - use std::cell::RefCell; use std::sync::{Arc}; use std::time::Duration; @@ -12,13 +6,11 @@ use winit::event::{ElementState, WindowEvent}; use winit::keyboard::KeyCode; use crate::tacmap::TacticalMap; -use crate::{GameState, SystemicApp}; +use crate::{GameState, SystemicApp, ui}; use crate::solar_system::{SolarSystem, SystemId}; use crate::wgpuctx::{RenderPassBuilder, WgpuCtx}; use crate::eguictx::EguiCtx; -use ui::*; - pub struct GameWindow { window: Arc<winit::window::Window>, @@ -27,7 +19,7 @@ pub struct GameWindow tactical_map: TacticalMap, - ui_state: GameWindowUiState + ui_state: ui::State } impl GameWindow @@ -51,6 +43,15 @@ impl GameWindow winit::dpi::LogicalPosition::new(0.0, 0.0), winit::dpi::LogicalSize::new(1.0, 1.0)); + let ui_state = ui::State{ + current_system: Some(0), + camera_info: ui::camera_info::CameraWindowState { + target: Some(0), + ..Default::default() + }, + ..Default::default() + }; + Ok(Self { window: window, wgpuctx: wgpuctx, @@ -66,6 +67,14 @@ impl GameWindow game_state: &RefCell<GameState>, dt: Duration) { + { + let mut game_state = game_state.borrow_mut(); + if self.ui_state.do_auto_tick { + game_state.timeman.auto_tick = self.ui_state.auto_time; + }else{ + game_state.timeman.auto_tick = None; + } + } self.tactical_map.update(game_state, &mut self.ui_state, dt); } @@ -103,7 +112,7 @@ impl GameWindow } { self.eguictx.prepare(&self.window); - self.ui_state = GameWindowUiState::render(&self.ui_state, game_state, &self.eguictx); + self.ui_state.render(game_state, &self.eguictx); self.eguictx.present( &self.window, |
