#imgui #winit #translation #layer #frame #boilerplate

imgui-winit

A simple translation layer between winit and imgui

2 releases

0.1.2 Dec 4, 2018
0.1.1 Nov 17, 2018
0.1.0 Nov 16, 2018

#59 in #winit

Unlicense/MIT

8KB
116 lines

imgui-winit

This is a simple translation layer between winit and imgui. It exists because I found myself repeating a bunch of specific boilerplate every time I used imgui, in order to translate winit events into imgui. This crate contains functionality for forwarding winit events to imgui, as well as keeping track of frame deltas and window size to pass to imgui.

Example usage

// Initialization
let mut imgui_winit = ImGuiWinit::new(&mut imgui);

loop {
    // In the main loop
    event_loop.poll_events(|event| {
        imgui_winit.handle_event(&mut imgui, &event);
        // Other event handling
    });

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

Dependencies

~15–24MB
~348K SLoC