Remove imgui from the entire project
This commit is contained in:
parent
306774c15b
commit
13aefcc86f
12 changed files with 16 additions and 125 deletions
38
Cargo.lock
generated
38
Cargo.lock
generated
|
|
@ -331,12 +331,6 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "chlorine"
|
|
||||||
version = "1.0.13"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c00d31b1d19317b4777ec879192d3745bd97d05262b4b19cb1dda284b9d22f19"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clipboard-win"
|
name = "clipboard-win"
|
||||||
version = "5.4.1"
|
version = "5.4.1"
|
||||||
|
|
@ -1206,31 +1200,6 @@ dependencies = [
|
||||||
"zune-jpeg",
|
"zune-jpeg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "imgui"
|
|
||||||
version = "0.12.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8addafa5cecf0515812226e806913814e02ce38d10215778082af5174abe5669"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.3.2",
|
|
||||||
"cfg-if",
|
|
||||||
"imgui-sys",
|
|
||||||
"mint",
|
|
||||||
"parking_lot",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "imgui-sys"
|
|
||||||
version = "0.12.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ead193f9f4b60398e8b8f4ab1483e2321640d87aeebdaa3e5f44c55633ccd804"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"cfg-if",
|
|
||||||
"chlorine",
|
|
||||||
"mint",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.10.0"
|
version = "2.10.0"
|
||||||
|
|
@ -1423,12 +1392,6 @@ dependencies = [
|
||||||
"simd-adler32",
|
"simd-adler32",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mint"
|
|
||||||
version = "0.5.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e53debba6bda7a793e5f99b8dacf19e626084f525f7829104ba9898f367d85ff"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "moxcms"
|
name = "moxcms"
|
||||||
version = "0.7.5"
|
version = "0.7.5"
|
||||||
|
|
@ -2130,7 +2093,6 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"egui",
|
"egui",
|
||||||
"hecs",
|
"hecs",
|
||||||
"imgui",
|
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"raidillon_assets",
|
"raidillon_assets",
|
||||||
"winit",
|
"winit",
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,4 @@ hecs = "0.10.5"
|
||||||
indexmap = "2.10.0"
|
indexmap = "2.10.0"
|
||||||
raidillon_assets = { path = "../asset" }
|
raidillon_assets = { path = "../asset" }
|
||||||
winit = "0.30.12"
|
winit = "0.30.12"
|
||||||
imgui = "0.12.0"
|
|
||||||
egui = "0.33.2"
|
egui = "0.33.2"
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
pub enum UICommand {
|
|
||||||
Text(String),
|
|
||||||
Separator,
|
|
||||||
SliderF32 { label: String, min: f32, max: f32, value: std::rc::Rc<std::cell::RefCell<f32>> },
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct DebugUIBuffer {
|
|
||||||
cmds: Vec<UICommand>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl DebugUIBuffer {
|
|
||||||
pub fn new() -> DebugUIBuffer {
|
|
||||||
DebugUIBuffer { cmds: vec![] }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Commands
|
|
||||||
pub fn text(&mut self, text: String) {
|
|
||||||
self.cmds.push(UICommand::Text(text));
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn separator(&mut self) {
|
|
||||||
self.cmds.push(UICommand::Separator);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn slider_f32<T: Into<String>>(&mut self, label: T, min: f32, max: f32, value: std::rc::Rc<std::cell::RefCell<f32>>) {
|
|
||||||
self.cmds.push(UICommand::SliderF32 { label: label.into(), min, max, value });
|
|
||||||
}
|
|
||||||
// End of commands
|
|
||||||
|
|
||||||
pub fn write_buffer(&self, ui: &imgui::Ui) {
|
|
||||||
for cmd in &self.cmds {
|
|
||||||
match cmd {
|
|
||||||
UICommand::Text(s) => {
|
|
||||||
ui.text(s);
|
|
||||||
}
|
|
||||||
UICommand::Separator => {
|
|
||||||
ui.separator();
|
|
||||||
}
|
|
||||||
UICommand::SliderF32 { label, min, max, value } => {
|
|
||||||
let mut v = value.borrow_mut();
|
|
||||||
ui.slider_config(label.as_str(), *min, *max).build(&mut *v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn reset_buffer(&mut self) {
|
|
||||||
self.cmds = vec![];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
use crate::DebugUIBuffer;
|
|
||||||
use crate::scene::Scene;
|
use crate::scene::Scene;
|
||||||
|
|
||||||
pub trait EngineTrait {
|
pub trait EngineTrait {
|
||||||
|
|
@ -10,6 +9,4 @@ pub trait EngineTrait {
|
||||||
fn handle_event(&mut self, platform_context: Self::PlatformCtx);
|
fn handle_event(&mut self, platform_context: Self::PlatformCtx);
|
||||||
fn current_scene_mut(&mut self) -> &mut Scene;
|
fn current_scene_mut(&mut self) -> &mut Scene;
|
||||||
fn current_scene(&self) -> &Scene;
|
fn current_scene(&self) -> &Scene;
|
||||||
fn get_debug_ui_buffer(&self) -> &DebugUIBuffer;
|
|
||||||
fn reset_debug_ui_buffer(&mut self);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
pub mod engine;
|
pub mod engine;
|
||||||
pub mod debug_ui;
|
|
||||||
pub mod time;
|
pub mod time;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
pub mod scene;
|
pub mod scene;
|
||||||
mod egui_queue;
|
mod egui_queue;
|
||||||
|
|
||||||
pub use debug_ui::*;
|
|
||||||
pub use egui_queue::EguiQueue;
|
pub use egui_queue::EguiQueue;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use crate::{define_typemap, DebugUIBuffer};
|
use crate::{define_typemap};
|
||||||
|
|
||||||
pub struct Scene {
|
pub struct Scene {
|
||||||
pub title: String,
|
pub title: String,
|
||||||
|
|
@ -23,10 +23,7 @@ impl Scene {
|
||||||
s
|
s
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load_default_resources(&mut self) {
|
pub fn load_default_resources(&mut self) {}
|
||||||
let dbg = DebugUIBuffer::new();
|
|
||||||
self.resources.insert(dbg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Scene {}
|
impl Scene {}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use std::rc::Rc;
|
||||||
use raidillon_core::scene::{Scene, SceneManager};
|
use raidillon_core::scene::{Scene, SceneManager};
|
||||||
use crate::system::{SystemContext, SystemManager};
|
use crate::system::{SystemContext, SystemManager};
|
||||||
use raidillon_platform::PlatformContext;
|
use raidillon_platform::PlatformContext;
|
||||||
use raidillon_core::{define_typemap, DebugUIBuffer};
|
use raidillon_core::{define_typemap};
|
||||||
use raidillon_core::engine::EngineTrait;
|
use raidillon_core::engine::EngineTrait;
|
||||||
use crate::input::InputState;
|
use crate::input::InputState;
|
||||||
use crate::resources::EngineResources;
|
use crate::resources::EngineResources;
|
||||||
|
|
@ -50,7 +50,6 @@ impl EngineTrait for Engine {
|
||||||
|
|
||||||
/// Update the engine
|
/// Update the engine
|
||||||
fn frame_update(&mut self, platform_context: PlatformContext) {
|
fn frame_update(&mut self, platform_context: PlatformContext) {
|
||||||
self.scene_manager.current_mut().resources.get_mut::<DebugUIBuffer>().unwrap().reset_buffer();
|
|
||||||
self.resources.insert(platform_context);
|
self.resources.insert(platform_context);
|
||||||
|
|
||||||
for system in self.system_manager.systems.values_mut() {
|
for system in self.system_manager.systems.values_mut() {
|
||||||
|
|
@ -86,12 +85,4 @@ impl EngineTrait for Engine {
|
||||||
fn current_scene(&self) -> &Scene {
|
fn current_scene(&self) -> &Scene {
|
||||||
self.scene_manager.current()
|
self.scene_manager.current()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_debug_ui_buffer(&self) -> &DebugUIBuffer {
|
|
||||||
self.scene_manager.current().resources.get::<DebugUIBuffer>().unwrap()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn reset_debug_ui_buffer(&mut self) {
|
|
||||||
self.scene_manager.current_mut().resources.get_mut::<DebugUIBuffer>().unwrap().reset_buffer();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use raidillon_core::scene::Scene;
|
use raidillon_core::scene::Scene;
|
||||||
use raidillon_core::DebugUIBuffer;
|
|
||||||
use raidillon_platform::PlatformContext;
|
use raidillon_platform::PlatformContext;
|
||||||
use std::any::TypeId;
|
use std::any::TypeId;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
|
@ -11,7 +10,6 @@ use crate::resources::EngineResources;
|
||||||
pub struct SystemContext<'a> {
|
pub struct SystemContext<'a> {
|
||||||
pub scene: &'a mut Scene,
|
pub scene: &'a mut Scene,
|
||||||
pub platform_context: PlatformContext,
|
pub platform_context: PlatformContext,
|
||||||
pub debug_ui_buffer: Rc<RefCell<DebugUIBuffer>>,
|
|
||||||
pub input_state: Rc<RefCell<InputState>>,
|
pub input_state: Rc<RefCell<InputState>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ use raidillon_glium::GliumPlatform;
|
||||||
use winit::event::{ElementState, Event, WindowEvent};
|
use winit::event::{ElementState, Event, WindowEvent};
|
||||||
use winit::event::DeviceEvent::MouseMotion;
|
use winit::event::DeviceEvent::MouseMotion;
|
||||||
use winit::keyboard::{KeyCode, PhysicalKey};
|
use winit::keyboard::{KeyCode, PhysicalKey};
|
||||||
use raidillon_core::{DebugUIBuffer, EguiQueue};
|
use raidillon_core::{EguiQueue};
|
||||||
use systems::debug_camera::FPSDebugCameraSystem;
|
use systems::debug_camera::FPSDebugCameraSystem;
|
||||||
use raidillon_glium::RenderingSystem;
|
use raidillon_glium::RenderingSystem;
|
||||||
use raidillon_physics::Physics;
|
use raidillon_physics::Physics;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
use winit::keyboard::KeyCode;
|
use winit::keyboard::KeyCode;
|
||||||
use raidillon_core::DebugUIBuffer;
|
|
||||||
use raidillon_core::scene::Scene;
|
use raidillon_core::scene::Scene;
|
||||||
use raidillon_ecs::components::CameraMode;
|
use raidillon_ecs::components::CameraMode;
|
||||||
use raidillon_engine::{EngineResources, InputState};
|
use raidillon_engine::{EngineResources, InputState};
|
||||||
|
|
@ -24,16 +23,21 @@ impl System for KeybindsSystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn frame_update(&mut self, res: &mut EngineResources, scene: &mut Scene) {
|
fn frame_update(&mut self, res: &mut EngineResources, scene: &mut Scene) {
|
||||||
let dbg_ui = scene.resources.get_mut::<DebugUIBuffer>().unwrap();
|
let pctx = res.get_mut::<PlatformContext>().unwrap();
|
||||||
|
|
||||||
dbg_ui.text("F5 to switch camera".to_owned());
|
|
||||||
|
|
||||||
let mut q = scene.world.query::<(&Camera, &CameraMode)>();
|
let mut q = scene.world.query::<(&Camera, &CameraMode)>();
|
||||||
let (cam_ent, (cam, cam_mode)) = q
|
let (cam_ent, (cam, cam_mode)) = q
|
||||||
.iter()
|
.iter()
|
||||||
.next()
|
.next()
|
||||||
.unwrap();
|
.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);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,17 +103,13 @@ impl<E: EngineTrait<PlatformCtx = PlatformContext>> Platform<E> for GliumPlatfor
|
||||||
WindowEvent::RedrawRequested => {
|
WindowEvent::RedrawRequested => {
|
||||||
let mut target = self.display.draw();
|
let mut target = self.display.draw();
|
||||||
target.clear_color_and_depth((0.1, 0.1, 0.15, 1.0), 1.0);
|
target.clear_color_and_depth((0.1, 0.1, 0.15, 1.0), 1.0);
|
||||||
let (scene, debug_ui_buffer) = (
|
let scene = self.engine.current_scene();
|
||||||
self.engine.current_scene(),
|
|
||||||
self.engine.get_debug_ui_buffer(),
|
|
||||||
);
|
|
||||||
let mut context = RenderingContext {
|
let mut context = RenderingContext {
|
||||||
scene,
|
scene,
|
||||||
target: &mut target,
|
target: &mut target,
|
||||||
display: &self.display,
|
display: &self.display,
|
||||||
asset_manager: self.asset_manager.clone(),
|
asset_manager: self.asset_manager.clone(),
|
||||||
window: self.window.clone(),
|
window: self.window.clone(),
|
||||||
debug_ui_buffer,
|
|
||||||
egui_queue: self.egui_queue.clone(),
|
egui_queue: self.egui_queue.clone(),
|
||||||
env_light_dir: Vec3::new(0.0, -1.0, 0.0),
|
env_light_dir: Vec3::new(0.0, -1.0, 0.0),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use indexmap::IndexMap;
|
||||||
use glium::{Display, Frame};
|
use glium::{Display, Frame};
|
||||||
use glium::glutin::surface::WindowSurface;
|
use glium::glutin::surface::WindowSurface;
|
||||||
use raidillon_assets::ModelManagerRef;
|
use raidillon_assets::ModelManagerRef;
|
||||||
use raidillon_core::{define_typemap, DebugUIBuffer, EguiQueue};
|
use raidillon_core::{define_typemap, EguiQueue};
|
||||||
use raidillon_core::scene::Scene;
|
use raidillon_core::scene::Scene;
|
||||||
use glam::Vec3;
|
use glam::Vec3;
|
||||||
use winit::event_loop::EventLoop;
|
use winit::event_loop::EventLoop;
|
||||||
|
|
@ -17,7 +17,6 @@ pub struct RenderingContext<'a> {
|
||||||
pub window: Arc<Mutex<glium::winit::window::Window>>,
|
pub window: Arc<Mutex<glium::winit::window::Window>>,
|
||||||
pub display: &'a Display<WindowSurface>,
|
pub display: &'a Display<WindowSurface>,
|
||||||
pub asset_manager: ModelManagerRef,
|
pub asset_manager: ModelManagerRef,
|
||||||
pub debug_ui_buffer: &'a DebugUIBuffer,
|
|
||||||
pub egui_queue: Rc<RefCell<EguiQueue>>,
|
pub egui_queue: Rc<RefCell<EguiQueue>>,
|
||||||
pub env_light_dir: Vec3,
|
pub env_light_dir: Vec3,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue