imgui-glfw-rs

Crates.ioimgui-glfw-rs
lib.rsimgui-glfw-rs
version0.4.1
sourcesrc
created_at2018-12-28 10:35:24.783705
updated_at2019-08-13 17:59:23.971736
descriptionImGui input handling for GLFW
homepagehttps://github.com/K4ugummi/imgui-glfw-rs
repositoryhttps://github.com/K4ugummi/imgui-glfw-rs
max_upload_size
id104204
size243,398
Stephan Schauerte (K4ugummi)

documentation

README

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

Commit count: 34

cargo fmt