Crate imgui_glfw_rs

source ·
Expand description

ImGui input handling for Glfw.

Example use

You can run this example with cargo run --example helloworld

use imgui_glfw_rs::ImguiGLFW;

fn main() {
    // Initialize imgui and glfw.
    // { ... }

    let mut imgui_glfw = ImguiGLFW::new(&mut imgui);

    while !window.should_close() {
        unsafe {
            gl::Clear(gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT);
        }

        let ui = imgui_glfw.frame(&mut window, &mut imgui);
        // Draw your ui.
        // { ... }

        // Handle imgui events
        glfw.poll_events();
        for (_, event) in glfw::flush_messages(&events) {
            imgui_glfw.handle_event(&mut imgui, &event);
        }
    }
}

Structs