Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/TheRacc2/egui-keybinds
https://github.com/TheRacc2/egui-keybinds
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/TheRacc2/egui-keybinds
- Owner: liam-lemonade
- Created: 2023-02-10T05:37:42.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-02-04T01:54:11.000Z (9 months ago)
- Last Synced: 2024-05-21T18:11:16.531Z (6 months ago)
- Language: Rust
- Size: 154 KB
- Stars: 1
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-egui - egui-keybinds
README
# egui-keybinds
designed for ease-of-use, **egui-keybinds** provides keybinding functionality to [egui](https://crates.io/crates/egui)# Example
```rust
use egui::{CentralPanel, Context, Widget};
use egui_keybinds::{KeyBind, KeyBindWidget, KeyCode};struct Gui {
key1: KeyBind,
key2: KeyBind,
}impl Gui {
fn new() -> Self {
Self {
key1: KeyBind::new(Some(KeyCode::A), vec![]),
key2: KeyBind::new(Some(KeyCode::B), vec![]),
}
}
}impl eframe::App for Gui {
fn update(&mut self, ctx: &Context, _frame: &mut eframe::Frame) {
CentralPanel::default().show(ctx, |ui| {
ui.label("Example keybind 1");
KeyBindWidget::new(&mut self.key1).ui(ui);ui.label("Example keybind 2");
KeyBindWidget::new(&mut self.key2).ui(ui);
});
}
}fn main() {
eframe::run_native(
"testing",
Default::default(),
Box::new(|_| Box::new(Gui::new())),
)
.unwrap();
}
```# Add to your project
run `cargo add egui-keybinds` in your terminal of choice while CD'd into the root directory of your project.