GLFW input handling for imgui
// Use the reexported glfw crate to avoid version conflicts.
use imgui_glfw_rs::glfw;
// Use the reexported imgui crate to avoid version conflicts.
use imgui_glfw_rs::imgui;
use imgui_glfw_rs::ImguiGLFW;
// ImGui uses { ... }
fn main() {
// Initialize imgui and glfw and imgui renderer.
// { ... }
let mut imgui_glfw = ImguiGLFW::new(&mut imgui);
while !window.should_close() {
let ui = imgui_glfw.frame(&mut window, &mut imgui);
// Draw your ui.
// { ... }
window.swap_buffers();
// Handle imgui events
glfw.poll_events();
for (_, event) in glfw::flush_messages(&events) {
imgui_glfw.handle_event(&mut imgui, &event);
}
}
}
- MouseButton press and release
- CursorPos movement
- Scroll movement
- Char input
- Key press and release
- Modifier handling
- Cursor icons
- Clipboard copying/pasting
git clone https://github.com/K4ugummi/imgui-glfw-rs.git
cd imgui-glfw-rs
cargo run --example helloworld
- Make some changes
- Run rustfmt for code style conformance
cargo fmt
- Open a pull request
- The piston developers for maintaining the glfw crate.
- Gekkio for maintaining the imgui bindings for rust.
- You for using this crate and maybe even providing feedback