#imgui #sdl2 #input

imgui-sdl2

SDL2 Input handling for imgui-rs

18 releases (breaking)

Uses old Rust 2015

0.14.0 Feb 14, 2021
0.13.0 Dec 8, 2020
0.12.0 Sep 29, 2020
0.11.0 Jun 13, 2020
0.2.2 Jun 6, 2018

#37 in GUI

Download history 220/week @ 2021-04-11 207/week @ 2021-04-18 289/week @ 2021-04-25 291/week @ 2021-05-02 353/week @ 2021-05-09 327/week @ 2021-05-16 99/week @ 2021-05-23 167/week @ 2021-05-30 111/week @ 2021-06-06 81/week @ 2021-06-13 79/week @ 2021-06-20 75/week @ 2021-06-27 58/week @ 2021-07-04 63/week @ 2021-07-11 74/week @ 2021-07-18 73/week @ 2021-07-25

1,032 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

~5MB
~108K SLoC