diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-02 11:12:06 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-02 11:12:06 +0300 |
| commit | 733f9d92e0d4e40ed40db42fa6cd11294e49eb7b (patch) | |
| tree | 824dde369c5fbb7b3180c42899c4f0555929ca4b /apps/fparkan-game/src/mission_overlay.rs | |
| parent | 61208d874cb3d9bf93e9f7c60aceebc287454b62 (diff) | |
| download | fparkan-733f9d92e0d4e40ed40db42fa6cd11294e49eb7b.tar.xz fparkan-733f9d92e0d4e40ed40db42fa6cd11294e49eb7b.zip | |
feat(ui): show native strategic waypoint cursors
Read the animated cursor strips and their hotspots from the installed UI atlas. Use the native Land.map areal flag and chassis selector for both the preview cursor and waypoint input. In stock Two Fortresses, compared one accepted and one rejected map point against the original and checked the return to the cockpit with Vulkan validation.
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(()) } } |
