23 releases (14 breaking)

Uses old Rust 2015

0.15.3 Dec 5, 2023
0.15.2 Aug 26, 2023
0.15.1 Jan 14, 2023
0.15.0 Feb 28, 2022
0.2.2 Jun 6, 2018

#527 in GUI

Download history 22/week @ 2024-07-21 25/week @ 2024-07-28 9/week @ 2024-08-04 22/week @ 2024-08-11 15/week @ 2024-08-18 24/week @ 2024-08-25 31/week @ 2024-09-01 17/week @ 2024-09-08 19/week @ 2024-09-15 139/week @ 2024-09-22 48/week @ 2024-09-29 11/week @ 2024-10-06 25/week @ 2024-10-13 21/week @ 2024-10-20 29/week @ 2024-10-27 24/week @ 2024-11-03

101 downloads per month
Used in 2 crates

MIT/Apache

12KB
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

~33MB
~585K SLoC