Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matchachoco010/egui-winit-ash-integration
This is the egui integration crate for winit and ash.
https://github.com/matchachoco010/egui-winit-ash-integration
Last synced: about 2 months ago
JSON representation
This is the egui integration crate for winit and ash.
- Host: GitHub
- URL: https://github.com/matchachoco010/egui-winit-ash-integration
- Owner: MatchaChoco010
- License: apache-2.0
- Created: 2021-09-09T15:49:07.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-06T12:19:45.000Z (9 months ago)
- Last Synced: 2024-04-14T10:49:17.975Z (9 months ago)
- Language: Rust
- Size: 501 KB
- Stars: 18
- Watchers: 2
- Forks: 21
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# egui-winit-ash-integration
[![Latest version](https://img.shields.io/crates/v/egui-winit-ash-integration.svg)](https://crates.io/crates/egui-winit-ash-integration)
[![Documentation](https://docs.rs/egui-winit-ash-integration/badge.svg)](https://docs.rs/egui-winit-ash-integration)
![MIT](https://img.shields.io/badge/license-MIT-blue.svg)
![Apache](https://img.shields.io/badge/license-Apache-blue.svg)
[![egui version: 0.23.0](https://img.shields.io/badge/egui%20version-0.23.0-orange)](https://docs.rs/egui/0.23.0/egui/index.html)This is the [egui](https://github.com/emilk/egui) integration crate for [egui-winit](https://github.com/emilk/egui/tree/master/crates/egui-winit) and [ash](https://github.com/MaikKlein/ash).
The default GPU allocator is [gpu_allocator](https://github.com/Traverse-Research/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](https://github.com/MatchaChoco010/egui-ash) is an alternative crate, which supports multi-viewports, so please take a look at this one.
# Example
```sh
cargo run --example example
``````sh
cargo run --example user_texture
```# Usage
```rust
fn main() -> Result<()> {
let event_loop = EventLoop::new();
// (1) Call Integration::>>::new() in App::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: _ } => {
// (2) Call integration.handle_event(&event).
let _response = app.egui_integration.handle_event(&event);
match event {
WindowEvent::Resized(_) => {
app.recreate_swapchain().unwrap();
}
WindowEvent::ScaleFactorChanged { .. } => {
// (3) Call integration.recreate_swapchain(...) in app.recreate_swapchain().
app.recreate_swapchain().unwrap();
}
WindowEvent::CloseRequested => {
*control_flow = ControlFlow::Exit;
}
_ => (),
}
},
Event::MainEventsCleared => app.window.request_redraw(),
Event::RedrawRequested(_window_id) => {
// (4) Call integration.begin_frame(), integration.end_frame(&mut window),
// integration.context().tessellate(shapes), integration.paint(...)
// in app.draw().
app.draw().unwrap();
},
_ => (),
}
})
}
// (5) Call integration.destroy() when drop app.
```[Full example is in examples directory](https://github.com/MatchaChoco010/egui-winit-ash-integration/tree/main/examples)
# Feature flags
`gpu-allocator-feature` - Enables the gpu-allocator crate.
The other features directly control the underlying [egui_winit features](https://docs.rs/egui-winit/latest/egui_winit/)
# License
MIT OR Apache-2.0