egui-winit-ash-integration
![egui version: 0.23.0](https://img.shields.io/badge/egui%20version-0.23.0-orange)
This is the egui integration crate for egui-winit and ash.
The default GPU allocator is gpu_allocator, but you can also implement AllocatorTrait.
This crate does not support multi-viewports for multi-window since version 0.24 of egui.
egui-ash is an alternative crate, which supports multi-viewports, so please take a look at this one.
Example
cargo run --example example
cargo run --example user_texture
Usage
fn main() -> Result<()> {
let event_loop = EventLoop::new();
let mut app = App::new(&event_loop)?;
event_loop.run(move |event, _, control_flow| {
*control_flow = ControlFlow::Poll;
match event {
Event::WindowEvent { event, window_id: _ } => {
let _response = app.egui_integration.handle_event(&event);
match event {
WindowEvent::Resized(_) => {
app.recreate_swapchain().unwrap();
}
WindowEvent::ScaleFactorChanged { .. } => {
app.recreate_swapchain().unwrap();
}
WindowEvent::CloseRequested => {
*control_flow = ControlFlow::Exit;
}
_ => (),
}
},
Event::MainEventsCleared => app.window.request_redraw(),
Event::RedrawRequested(_window_id) => {
app.draw().unwrap();
},
_ => (),
}
})
}
Full example is in examples directory
Feature flags
gpu-allocator-feature
- Enables the gpu-allocator crate.
The other features directly control the underlying egui_winit features
License
MIT OR Apache-2.0