From f3429702288a23ff4ae0c734d18180d6011a359e Mon Sep 17 00:00:00 2001 From: Amatsugu Date: Mon, 16 Mar 2026 22:58:12 -0400 Subject: [PATCH] ui testing --- game/main/src/phos.rs | 4 ++-- game/main/src/ui/build_ui.rs | 25 +++++++++++++++++++------ game/main/src/utlis/editor_plugin.rs | 10 +++++----- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/game/main/src/phos.rs b/game/main/src/phos.rs index fbe2af1..edea707 100644 --- a/game/main/src/phos.rs +++ b/game/main/src/phos.rs @@ -45,8 +45,8 @@ impl Plugin for PhosGamePlugin // UnitsPlugin, DespawnPuglin, TileSelectionPlugin, - #[cfg(debug_assertions)] - EditorPlugin, + // #[cfg(debug_assertions)] + // EditorPlugin, #[cfg(debug_assertions)] DebugPlugin, )); diff --git a/game/main/src/ui/build_ui.rs b/game/main/src/ui/build_ui.rs index 99d8784..58f6cfb 100644 --- a/game/main/src/ui/build_ui.rs +++ b/game/main/src/ui/build_ui.rs @@ -33,10 +33,6 @@ fn setup_cameras(mut commands: Commands) order: 1, clear_color: ClearColorConfig::None, msaa_writeback: MsaaWriteback::Always, - // viewport: Some(Viewport { - // physical_size: UVec2::new(800, 800), - // ..default() - // }), output_mode: CameraOutputMode::Write { blend_state: Some(BlendState::ALPHA_BLENDING), clear_color: ClearColorConfig::None, @@ -83,9 +79,11 @@ fn spawn_ui(mut commands: Commands, mut next_state: ResMut(); app.add_systems(PostUpdate, prepare_image.run_if(in_state(GeneratorState::SpawnMap))); - // app.add_systems( - // Update, - // (render_map_ui, update_map_render, asset_reloaded).run_if(in_state(GeneratorState::Idle)), - // ); + app.add_systems( + Update, + (render_map_ui, update_map_render, asset_reloaded).run_if(in_state(GeneratorState::Idle)), + ); } } @@ -99,7 +99,7 @@ fn render_map_ui( mut state: ResMut, ) { - let id = contexts.add_image(EguiTextureHandle::Strong(image.0.clone())); + let id = contexts.add_image(EguiTextureHandle::Weak(image.0.id())); let mut map_type = state.target_map_type; let ctx = contexts.ctx_mut().expect("Failed to get egui context"); egui::Window::new("Map").open(&mut state.is_open).show(ctx, |ui| {