Skip to content

michaelfairley/rust-imgui-sdl2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

SDL2 Input handling for imgui-rs

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages