Merge branch '2025-11-16-egui'
This commit is contained in:
commit
1f03afdab5
22 changed files with 816 additions and 323 deletions
|
|
@ -19,3 +19,4 @@ glam = "0.30.5"
|
|||
winit = "0.30.12"
|
||||
rapier3d = "0.30.1"
|
||||
hecs = "0.10.5"
|
||||
egui = "0.33.2"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use raidillon_glium::GliumPlatform;
|
|||
use winit::event::{ElementState, Event, WindowEvent};
|
||||
use winit::event::DeviceEvent::MouseMotion;
|
||||
use winit::keyboard::{KeyCode, PhysicalKey};
|
||||
use raidillon_core::DebugUIBuffer;
|
||||
use raidillon_core::{EguiQueue};
|
||||
use systems::debug_camera::FPSDebugCameraSystem;
|
||||
use raidillon_glium::RenderingSystem;
|
||||
use raidillon_physics::Physics;
|
||||
|
|
@ -102,18 +102,30 @@ impl System for RenderingTestSystem {
|
|||
}
|
||||
|
||||
fn frame_update(&mut self, res: &mut EngineResources, scene: &mut Scene) {
|
||||
let pctx = res.get::<PlatformContext>().unwrap();
|
||||
let input = res.get::<InputState>().unwrap();
|
||||
let dbg_ui = scene.resources.get_mut::<DebugUIBuffer>().unwrap();
|
||||
|
||||
dbg_ui.text("Hello World!".to_owned());
|
||||
dbg_ui.text(format!("Frame Delta: {}", pctx.time_ctx.frame_dt));
|
||||
dbg_ui.text(format!("Fixed Delta: {}", pctx.time_ctx.fixed_dt));
|
||||
dbg_ui.text(format!("FPS: {}", 1.0 / pctx.time_ctx.frame_dt));
|
||||
let (
|
||||
pctx,
|
||||
input,
|
||||
) = res.get_many_mut::<(
|
||||
PlatformContext,
|
||||
InputState,
|
||||
)>().unwrap();
|
||||
|
||||
let mut egui_queue = pctx.egui_queue.borrow_mut();
|
||||
let time_ctx = pctx.time_ctx.clone();
|
||||
let mut character_pos = Vec3::ZERO;
|
||||
for (_ent, (tr, ch_component)) in scene.world.query::<(&Transform, &CharacterBodyComponent)>().iter() {
|
||||
dbg_ui.text(format!("Character POS: {}", tr.translation));
|
||||
character_pos = tr.translation;
|
||||
}
|
||||
egui_queue.queue(move |egui_ctx| {
|
||||
egui::Window::new("Debug").show(egui_ctx, |ui| {
|
||||
ui.label("Hello World!");
|
||||
ui.label(format!("Frame Delta: {}", time_ctx.frame_dt));
|
||||
ui.label(format!("Fixed Delta: {}", time_ctx.fixed_dt));
|
||||
ui.label(format!("FPS: {}", 1.0 / time_ctx.frame_dt));
|
||||
ui.label(format!("Character POS: {}", character_pos));
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use winit::keyboard::KeyCode;
|
||||
use raidillon_core::DebugUIBuffer;
|
||||
use raidillon_core::scene::Scene;
|
||||
use raidillon_ecs::components::CameraMode;
|
||||
use raidillon_engine::{EngineResources, InputState};
|
||||
|
|
@ -24,16 +23,21 @@ impl System for KeybindsSystem {
|
|||
}
|
||||
|
||||
fn frame_update(&mut self, res: &mut EngineResources, scene: &mut Scene) {
|
||||
let dbg_ui = scene.resources.get_mut::<DebugUIBuffer>().unwrap();
|
||||
|
||||
dbg_ui.text("F5 to switch camera".to_owned());
|
||||
|
||||
let pctx = res.get_mut::<PlatformContext>().unwrap();
|
||||
let mut q = scene.world.query::<(&Camera, &CameraMode)>();
|
||||
let (cam_ent, (cam, cam_mode)) = q
|
||||
.iter()
|
||||
.next()
|
||||
.unwrap();
|
||||
dbg_ui.text(format!("Camera Mode: {:?}", cam_mode));
|
||||
|
||||
let cam_mode_str = format!("Camera Mode: {:?}", cam_mode);
|
||||
|
||||
pctx.egui_queue.borrow_mut().queue(move |egui_ctx| {
|
||||
egui::Window::new("Camera").show(egui_ctx, |ui| {
|
||||
ui.label("F5 to switch camera");
|
||||
ui.label(cam_mode_str);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue