egui-bind
Library for showing key and pointer binds

Installation
[dependencies]
egui-bind = "*"
Example
use eframe::{run_native, App, CreationContext, Frame, NativeOptions};
use egui::{Context, Modifiers, Window};
use egui_bind::{Bind, BindTarget, KeyOrPointer};
type Binding = Option<(KeyOrPointer, Modifiers)>;
#[derive(Default)]
struct ExampleApp {
bind: Binding,
count: usize,
check: bool,
}
impl App for ExampleApp {
fn update(&mut self, ctx: &Context, _: &mut Frame) {
Window::new("Example").show(ctx, |ui| {
if self.bind.pressed(ctx) {
self.count += 1;
self.check = !self.check;
}
let r = ui.checkbox(&mut self.check, "Check");
if egui_bind::show_bind_popup(ui, &mut self.bind, "check_popup", &r) {
println!("Rebinded from popup");
}
if ui.add(Bind::new("_test", &mut self.bind)).changed() {
println!("Rebinded!");
}
ui.label(format!("Counter: {}", self.count));
});
}
}