debug friction egui

This commit is contained in:
2026-09-20 12:24:13 +02:00
parent b80b4e1aab
commit 5feca5194d
3 changed files with 14 additions and 4 deletions
+5 -2
View File
@@ -2,7 +2,7 @@ use bevy::{
diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin}, diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin},
prelude::*, prelude::*,
}; };
use bevy_egui::{EguiContexts, egui}; use bevy_egui::{EguiContexts, EguiPrimaryContextPass, egui};
use crate::{ use crate::{
config::{SCREEN_HEIGHT, SCREEN_WIDTH}, config::{SCREEN_HEIGHT, SCREEN_WIDTH},
@@ -253,10 +253,13 @@ impl Plugin for DebugPlugin {
update_seed_debug_text, update_seed_debug_text,
update_fps_debug_text, update_fps_debug_text,
update_view_debug_text, update_view_debug_text,
move_tuning_panel,
) )
.run_if(in_state(GameState::InGame)), .run_if(in_state(GameState::InGame)),
) )
.add_systems(
EguiPrimaryContextPass,
move_tuning_panel.run_if(in_state(GameState::InGame)),
)
.add_plugins(FrameTimeDiagnosticsPlugin::default()) .add_plugins(FrameTimeDiagnosticsPlugin::default())
.add_systems(OnExit(GameState::InGame), cleanup_debug); .add_systems(OnExit(GameState::InGame), cleanup_debug);
} }
+7 -2
View File
@@ -1,5 +1,6 @@
use bevy::{prelude::*, window::PresentMode}; use bevy::{prelude::*, window::PresentMode};
use bevy_egui::EguiPlugin;
use bevy_egui::{EguiGlobalSettings, EguiPlugin};
use crate::config::{SCREEN_HEIGHT, SCREEN_WIDTH}; use crate::config::{SCREEN_HEIGHT, SCREEN_WIDTH};
use crate::debug::DebugPlugin; use crate::debug::DebugPlugin;
@@ -47,7 +48,11 @@ fn main() {
.add_plugins(GameStatePlugin) // Game states .add_plugins(GameStatePlugin) // Game states
.add_plugins(MainMenuPlugin) // Main Menu .add_plugins(MainMenuPlugin) // Main Menu
.add_plugins(GameOverPlugin) // GameOver .add_plugins(GameOverPlugin) // GameOver
.add_plugins(EguiPlugin::default()) .insert_resource(EguiGlobalSettings {
auto_create_primary_context: false,
..default()
})
.add_plugins(EguiPlugin::default()) // Debug UI
.add_plugins(DebugPlugin) // Debug .add_plugins(DebugPlugin) // Debug
.run(); .run();
} }
+2
View File
@@ -2,6 +2,7 @@ use bevy::camera::RenderTarget;
use bevy::camera::visibility::RenderLayers; use bevy::camera::visibility::RenderLayers;
use bevy::prelude::*; use bevy::prelude::*;
use bevy::render::render_resource::TextureFormat; use bevy::render::render_resource::TextureFormat;
use bevy_egui::PrimaryEguiContext;
use crate::config::{SCREEN_ASPECT, SCREEN_HEIGHT, SCREEN_WIDTH}; use crate::config::{SCREEN_ASPECT, SCREEN_HEIGHT, SCREEN_WIDTH};
use crate::gameplay::camera::MainCamera; use crate::gameplay::camera::MainCamera;
@@ -34,6 +35,7 @@ fn spawn_virtual_screen(mut commands: Commands, mut images: ResMut<Assets<Image>
commands.spawn(( commands.spawn((
DisplayScreen, DisplayScreen,
PrimaryEguiContext, // egui render over
Camera2d, Camera2d,
Camera { Camera {
order: 0, order: 0,