zao / rust-imgui-sdl2

SDL2 Input handling for imgui-rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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);
  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. After handling input, call frame to start drawing.
    let ui = imgui_sdl2.frame(&window, &mut imgui, &event_pump.mouse_state());

Take a look at the example app to see it all in context.

About

SDL2 Input handling for imgui-rs

License:Apache License 2.0


Languages

Language:Rust 100.0%