#imgui #glfw #input

imgui-glfw-rs

ImGui input handling for GLFW

9 releases

✓ Uses Rust 2018 edition

0.4.1 Aug 13, 2019
0.4.0 Aug 13, 2019
0.3.0 May 22, 2019
0.2.7 Feb 16, 2019
0.2.1 Dec 28, 2018

#66 in GUI

Download history 7/week @ 2019-04-29 12/week @ 2019-05-06 15/week @ 2019-05-13 42/week @ 2019-05-20 27/week @ 2019-05-27 26/week @ 2019-06-03 12/week @ 2019-06-10 22/week @ 2019-06-17 48/week @ 2019-06-24 33/week @ 2019-07-01 31/week @ 2019-07-08 3/week @ 2019-07-15 9/week @ 2019-07-22 11/week @ 2019-07-29 37/week @ 2019-08-05

102 downloads per month

MIT/Apache

130KB
147 lines

imgui-glfw-rs: GLFW Input handling for ImGui

EXPERIMENTAL!
crates.io Documentation on docs.rs Dependencies

GLFW input handling for imgui

How to use

// 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);
        }
    }
}

Current implemented things

  • MouseButton press and release
  • CursorPos movement
  • Scroll movement
  • Char input
  • Key press and release
  • Modifier handling
  • Cursor icons
  • Clipboard copying/pasting

Unimplemented things and known issues

Compiling and running the example

git clone https://github.com/K4ugummi/imgui-glfw-rs.git
cd imgui-glfw-rs
cargo run --example helloworld

Contributing

  1. Make some changes
  2. Run rustfmt for code style conformance
    cargo fmt
  3. Open a pull request

Thanks to

Dependencies

~9MB
~136K SLoC