SDL2 Input handling for imgui-rs
Construct it.
let mut imgui_sdl2 = imgui_sdl2::ImguiSdl2::new(&mut imgui, &window);
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; }
Call prepare_frame
before calling imgui.frame()
.
imgui_sdl2.prepare_frame(imgui.io_mut(), &window, &event_pump.mouse_state());
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.
Version | Tag | Published |
---|---|---|
0.13.0 | 2yrs ago | |
0.12.0 | 2yrs ago | |
0.11.0 | 2yrs ago | |
0.10.0 | 2yrs ago |