#imgui #sdl2 #input

imgui-sdl2

SDL2 Input handling for imgui-rs

15 releases (breaking)

Uses old Rust 2015

0.11.0 Jun 13, 2020
0.9.0 Mar 17, 2020
0.7.0 Sep 23, 2019
0.5.0 Feb 9, 2019
0.2.2 Jun 6, 2018

#52 in GUI

Download history 70/week @ 2020-06-06 74/week @ 2020-06-13 171/week @ 2020-06-20 189/week @ 2020-06-27 95/week @ 2020-07-04 149/week @ 2020-07-11 101/week @ 2020-07-18 81/week @ 2020-07-25 40/week @ 2020-08-01 58/week @ 2020-08-08 113/week @ 2020-08-15 63/week @ 2020-08-22 70/week @ 2020-08-29 182/week @ 2020-09-05 240/week @ 2020-09-12 66/week @ 2020-09-19

486 downloads per month
Used in imgui-ext

MIT/Apache

11KB
203 lines

imgui-sdl2

Build Status Documentation Version

SDL2 Input handling for imgui-rs

Integration guide

  1. Construct it.
    let mut imgui_sdl2 = imgui_sdl2::ImguiSdl2::new(&mut imgui, &window);
    
  2. At the top of your event handling loop, pass in the input events, and ignore the ones that imgui has captured.
    imgui_sdl2.handle_event(&mut imgui, &event);
    if imgui_sdl2.ignore_event(&event) { continue; }
    
  3. Call prepare_frame before calling imgui.frame().
    imgui_sdl2.prepare_frame(imgui.io_mut(), &window, &event_pump.mouse_state());
    
  4. Call prepare_render immediately before your UI rendering code.
    imgui_sdl2.prepare_render(&ui, &window);
    

Take a look at the example app to see it all in context.

Dependencies

~6.5MB
~139K SLoC