debug friction
This commit is contained in:
+31
-1
@@ -2,10 +2,14 @@ use bevy::{
|
||||
diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin},
|
||||
prelude::*,
|
||||
};
|
||||
use bevy_egui::{EguiContexts, egui};
|
||||
|
||||
use crate::{
|
||||
config::{SCREEN_HEIGHT, SCREEN_WIDTH},
|
||||
gameplay::{camera::MainCamera, player::Player},
|
||||
gameplay::{
|
||||
camera::MainCamera,
|
||||
player::{MoveSettings, Player},
|
||||
},
|
||||
states::GameState,
|
||||
world::RunSeed,
|
||||
};
|
||||
@@ -202,6 +206,31 @@ fn update_view_debug_text(mut text: Single<&mut Text, With<ViewDebugText>>) {
|
||||
text.0 = format!("View: {SCREEN_WIDTH:.0}x{SCREEN_HEIGHT:.0}");
|
||||
}
|
||||
|
||||
// Real time tuning movement & inertia sliders
|
||||
fn move_tuning_panel(mut contexts: EguiContexts, mut settings: ResMut<MoveSettings>) {
|
||||
egui::Window::new("Movement / Inertia ").show(
|
||||
contexts.ctx_mut().expect("egui context missing"),
|
||||
|ui| {
|
||||
ui.add(
|
||||
egui::Slider::new(&mut settings.horizontal_speed, 0.0..=1000.0).text("Max speed"),
|
||||
);
|
||||
ui.add(
|
||||
egui::Slider::new(&mut settings.horizontal_accel, 0.0..=10000.0)
|
||||
.text("Acceleration"),
|
||||
);
|
||||
ui.add(
|
||||
egui::Slider::new(&mut settings.horizontal_friction, 0.0..=10000.0)
|
||||
.text("Friction"),
|
||||
);
|
||||
ui.add(egui::Slider::new(&mut settings.fall_speed, 0.0..=2000.0).text("Fall"));
|
||||
ui.add(egui::Slider::new(&mut settings.dive_speed, 0.0..=5000.0).text("SpeeFall"));
|
||||
ui.add(
|
||||
egui::Slider::new(&mut settings.vertical_rate, 0.0..=10000.0).text("Vertical rate"),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
pub struct DebugPlugin;
|
||||
|
||||
impl Plugin for DebugPlugin {
|
||||
@@ -224,6 +253,7 @@ impl Plugin for DebugPlugin {
|
||||
update_seed_debug_text,
|
||||
update_fps_debug_text,
|
||||
update_view_debug_text,
|
||||
move_tuning_panel,
|
||||
)
|
||||
.run_if(in_state(GameState::InGame)),
|
||||
)
|
||||
|
||||
+3
-1
@@ -1,4 +1,5 @@
|
||||
use bevy::{prelude::*, window::PresentMode};
|
||||
use bevy_egui::EguiPlugin;
|
||||
|
||||
use crate::config::{SCREEN_HEIGHT, SCREEN_WIDTH};
|
||||
use crate::debug::DebugPlugin;
|
||||
@@ -43,9 +44,10 @@ fn main() {
|
||||
.add_plugins(BoundsPlugin) // Bound player
|
||||
.add_plugins(ScorePlugin) // Score
|
||||
.add_plugins(WorldPlugin) // Chunk logic
|
||||
.add_plugins(DebugPlugin) // Debug
|
||||
.add_plugins(GameStatePlugin) // Game states
|
||||
.add_plugins(MainMenuPlugin) // Main Menu
|
||||
.add_plugins(GameOverPlugin) // GameOver
|
||||
.add_plugins(EguiPlugin::default())
|
||||
.add_plugins(DebugPlugin) // Debug
|
||||
.run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user