#imgui #sdl2 #input

imgui-sdl2

SDL2 Input handling for imgui-rs

12 releases (7 breaking)

0.8.0 Feb 9, 2020
0.7.0 Sep 23, 2019
0.6.0 Aug 4, 2019
0.5.0 Feb 9, 2019
0.2.2 Jun 6, 2018

#71 in GUI

Download history 36/week @ 2019-11-07 43/week @ 2019-11-14 38/week @ 2019-11-21 38/week @ 2019-11-28 61/week @ 2019-12-05 81/week @ 2019-12-12 18/week @ 2019-12-19 31/week @ 2019-12-26 23/week @ 2020-01-02 211/week @ 2020-01-09 89/week @ 2020-01-16 21/week @ 2020-01-23 28/week @ 2020-01-30 45/week @ 2020-02-06 52/week @ 2020-02-13

242 downloads per month
Used in imgui-ext

MIT/Apache

12KB
202 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
~128K SLoC