An egui implementation for the ggez game framework
To make use of this implementation you must first add the "EguiBackend" inside your game structure and initialize it. Ej:
rust
struct MyGame {
egui_backend: EguiBackend,
...
}
...
let game = MyGame {
egui_backend: EguiBackend::default(), //or EguiBackend::new(ctx)
...
}
later, in the part of the "EventHandler", inside the "update" we will add the structure and logic of the ui, inside the "draw" we will send to draw the ui, and at the end we will detect the user input. Ej:
```rust
impl EventHandler
fn draw(&mut self, ctx: &mut Context) -> GameResult {
clear(ctx, Color::BLACK);
draw(ctx, &self.egui_backend, ([0.0, 0.0],))?;
present(ctx)
}
} ``` In this case we only handle the mouse input so we only use those three functions (mousebuttondownevent, mousebuttonupevent, mousemotionevent), it is not very necessary to explain them because their names are already very descriptive. If we need to manage other things in the window such as the keyboard, the size, or even the scale factor, there are also respective functions for that, check out the Input Documentation.
there are a few examples to know how to use this implementation.