diff options
Diffstat (limited to 'apps/fparkan-game/src/mission_overlay.rs')
| -rw-r--r-- | apps/fparkan-game/src/mission_overlay.rs | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/apps/fparkan-game/src/mission_overlay.rs b/apps/fparkan-game/src/mission_overlay.rs index 8825094b..66a40697 100644 --- a/apps/fparkan-game/src/mission_overlay.rs +++ b/apps/fparkan-game/src/mission_overlay.rs @@ -2,8 +2,9 @@ use super::{ append_environment_gradient_material, append_environment_range, cockpit_dial::CockpitDial, cockpit_radar_hud::CockpitRadarHud, factory_menu::FactoryProjectPanel, horizontal_fov, quad_indices, satellite_map::SatelliteMap, screen_tl_quad_vertices_pixels, - world_pipeline_state, DirectoryVfs, EnvironmentGpuRange, LegacyBlendMode, LegacyDepthMode, - StaticPreviewScene, StaticVulkanApp, VulkanStaticTexture, + strategy_cursor_hud::StrategyCursorHud, world_pipeline_state, DirectoryVfs, + EnvironmentGpuRange, LegacyBlendMode, LegacyDepthMode, StaticPreviewScene, StaticVulkanApp, + VulkanStaticTexture, }; #[cfg(windows)] use super::{ @@ -25,6 +26,7 @@ pub(super) use fparkan_assets::ui_sprite::source_over; pub(super) struct MissionOverlay { pub(super) satellite_map: Option<SatelliteMap>, strategy_toolbar: Option<EnvironmentGpuRange>, + pub(super) strategy_cursor: Option<StrategyCursorHud>, #[cfg(windows)] strategy_balance: Option<StrategicBalanceHud>, #[cfg(windows)] @@ -146,9 +148,15 @@ impl MissionOverlay { None }) }); + let strategy_cursor = cockpit.and_then(|_| { + StrategyCursorHud::load(root, preview) + .inspect_err(|error| eprintln!("strategy_cursor_unavailable reason={error}")) + .ok() + }); Self { satellite_map, strategy_toolbar, + strategy_cursor, #[cfg(windows)] strategy_balance, #[cfg(windows)] @@ -184,6 +192,11 @@ impl MissionOverlay { if let Some(toolbar) = self.strategy_toolbar { remove(toolbar.range_index, ranges, counts); } + if let Some(cursor) = &self.strategy_cursor { + for range in cursor.ranges() { + remove(range, ranges, counts); + } + } #[cfg(windows)] if let Some(balance) = &self.strategy_balance { remove(balance.range_index(), ranges, counts); @@ -226,6 +239,10 @@ impl StaticVulkanApp { pub(super) fn draw_mission_overlay(&mut self) -> Result<(), String> { #[cfg(windows)] let warbot_rows = self.strategic_warbot_rows(); + #[cfg(windows)] + let cursor = self.strategy_cursor(warbot_rows.len()); + #[cfg(not(windows))] + let cursor = self.strategy_cursor(0); let (Some(renderer), Some(frame)) = (&mut self.renderer, &self.pending_scene_update) else { return Ok(()); }; @@ -372,6 +389,12 @@ impl StaticVulkanApp { frame.clock.time_ms, )?; } + if let Some(hud) = &mut self.overlay.strategy_cursor { + if let Some(window) = &self.window { + hud.sync_visibility(window, cursor.is_some(), self.mouse_look); + } + hud.draw(renderer, &mut self.mesh, frame.clock.time_ms, cursor)?; + } Ok(()) } } |
