egui-winit-ash-integration
This is the egui integration crate for egui-winit and ash.
The default GPU allocator is gpu_allocator, but you can also implement AllocatorTrait.
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
License
MIT OR Apache-2.0