Update dependencies for egui-winit example (#176)

* Update egui-winit example to greatly simplify the platform event handler

- I was able to upstream this logic into the egui_winit_platform crate

* Fix the wgpu validation error
This commit is contained in:
Jay Oster 2021-06-08 07:34:47 -07:00 committed by GitHub
parent 338a63a40e
commit e5da717351
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 18 deletions

View file

@ -11,10 +11,17 @@ default = ["optimize"]
[dependencies] [dependencies]
egui = "0.12" egui = "0.12"
egui_wgpu_backend = "0.8"
egui_winit_platform = { version = "0.8", features = ["webbrowser"] }
env_logger = "0.8" env_logger = "0.8"
log = "0.4" log = "0.4"
pixels = { path = "../.." } pixels = { path = "../.." }
winit = "0.25" winit = "0.25"
winit_input_helper = "0.10" winit_input_helper = "0.10"
[dependencies.egui_wgpu_backend]
git = "https://github.com/hasenbanck/egui_wgpu_backend.git"
rev = "63a002c6a9b6c016e45806dd065864431caab621"
[dependencies.egui_winit_platform]
git = "https://github.com/hasenbanck/egui_winit_platform.git"
rev = "89c9c36ae835c9a28e2af3439f1cc41f18a66c0c"
features = ["webbrowser"]

View file

@ -32,7 +32,7 @@ impl Gui {
physical_height: height, physical_height: height,
scale_factor: scale_factor as f32, scale_factor: scale_factor as f32,
}; };
let rpass = RenderPass::new(&context.device, wgpu::TextureFormat::Bgra8UnormSrgb); let rpass = RenderPass::new(&context.device, wgpu::TextureFormat::Bgra8UnormSrgb, 1);
Self { Self {
start_time: Instant::now(), start_time: Instant::now(),
@ -46,21 +46,7 @@ impl Gui {
/// Handle input events from the window manager. /// Handle input events from the window manager.
pub(crate) fn handle_event(&mut self, event: &winit::event::Event<'_, ()>) { pub(crate) fn handle_event(&mut self, event: &winit::event::Event<'_, ()>) {
use winit::dpi::PhysicalSize; self.platform.handle_event(event);
use winit::event::Event::WindowEvent;
use winit::event::WindowEvent::Resized;
match &event {
WindowEvent {
event:
Resized(PhysicalSize {
width: 0,
height: 0,
}),
..
} => (),
_ => self.platform.handle_event(event),
}
} }
/// Resize egui. /// Resize egui.