mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-12 10:15:51 +00:00
Move egui_winit
state out of fj-viewer
This commit is contained in:
parent
006996a3d5
commit
b7aa5cfc58
@ -45,7 +45,7 @@ impl Renderer {
|
||||
/// Returns a new `Renderer`.
|
||||
pub async fn new(
|
||||
screen: &impl Screen<Window = egui_winit::winit::window::Window>,
|
||||
event_loop: &EventLoop<()>,
|
||||
_: &EventLoop<()>,
|
||||
) -> Result<Self, InitError> {
|
||||
let instance = wgpu::Instance::new(wgpu::Backends::PRIMARY);
|
||||
|
||||
@ -99,7 +99,6 @@ impl Renderer {
|
||||
// Don't ask me how I know.
|
||||
//
|
||||
|
||||
let egui_winit_state = egui_winit::State::new(event_loop);
|
||||
let egui_context = egui::Context::default();
|
||||
|
||||
// This is sound, as `window` is an object to create a surface upon.
|
||||
@ -243,7 +242,6 @@ impl Renderer {
|
||||
|
||||
egui: EguiState {
|
||||
context: egui_context,
|
||||
winit_state: egui_winit_state,
|
||||
render_pass: egui_rpass,
|
||||
options: Default::default(),
|
||||
},
|
||||
|
@ -8,7 +8,6 @@ pub struct EguiOptionsState {
|
||||
}
|
||||
|
||||
pub struct EguiState {
|
||||
pub winit_state: egui_winit::State,
|
||||
pub context: egui::Context,
|
||||
pub render_pass: egui_wgpu::renderer::RenderPass,
|
||||
pub options: EguiOptionsState,
|
||||
|
@ -43,6 +43,7 @@ pub fn run(
|
||||
|
||||
let mut input_handler = input::Handler::default();
|
||||
let mut renderer = block_on(Renderer::new(&window, &event_loop))?;
|
||||
let mut egui_winit_state = egui_winit::State::new(&event_loop);
|
||||
|
||||
let mut draw_config = DrawConfig::default();
|
||||
|
||||
@ -104,10 +105,7 @@ pub fn run(
|
||||
// The primary visible impact of this currently is that if you drag
|
||||
// a title bar that overlaps the model then both the model & window
|
||||
// get moved.
|
||||
renderer
|
||||
.egui
|
||||
.winit_state
|
||||
.on_event(&renderer.egui.context, window_event);
|
||||
egui_winit_state.on_event(&renderer.egui.context, window_event);
|
||||
}
|
||||
|
||||
// fj-window events
|
||||
@ -175,7 +173,7 @@ pub fn run(
|
||||
}
|
||||
|
||||
let egui_input =
|
||||
renderer.egui.winit_state.take_egui_input(window.window());
|
||||
egui_winit_state.take_egui_input(window.window());
|
||||
|
||||
if let Err(err) = renderer.draw(
|
||||
&camera,
|
||||
|
Loading…
Reference in New Issue
Block a user