SDL2 Input handling for imgui-rs
rust
let mut imgui_sdl2 = imgui_sdl2::ImguiSdl2::new(&mut imgui, &window);
rust
imgui_sdl2.handle_event(&mut imgui, &event);
if imgui_sdl2.ignore_event(&event) { continue; }
prepare_frame
before calling imgui.frame()
.
rust
imgui_sdl2.prepare_frame(imgui.io_mut(), &window, &event_pump.mouse_state());
prepare_render
immediately before your UI rendering code.
rust
imgui_sdl2.prepare_render(&ui, &window);
Take a look at the example app to see it all in context.