This crate provides a winit-based backend platform for imgui-rs.
A backend platform handles window/input device events and manages their state.
Using the library
There are five things you need to do to use this library correctly:
- Initialize a
WinitPlatform
instance - Attach it to a winit
Window
- Pass events to the platform (every frame)
- Call frame preparation callback (every frame)
- Call render preparation callback (every frame)
Complete example for winit 0.20+ (without a renderer)
# // TODO: Remove ignore when only one winit version is used
use Context;
use ;
use Instant;
use ;
use ;
use ;
let mut event_loop = new;
let mut window = new.unwrap;
let mut imgui = create;
// configure imgui-rs Context if necessary
let mut platform = init; // step 1
platform.attach_window; // step 2
let mut last_frame = now;
let mut run = true;
event_loop.run