egui-sdl3
This crate provides integration between egui and sdl3, including event handling and multiple rendering backends with a consistent API. It supports optional rendering backends:
- Software via
Canvas(canvas-backendfeature) - OpengGL via
glow(glow-backendfeature) - WebgGPU via
wgpu(wgpu-backendfeature)
The implementation is based on the design of the official egui-winit, egui_glow, egui-wgpu crates, aming to make it easy to use SDL3 with egui.
Both egui and sdl3 are re-exported for convenience. The sdl3 re-export includes all feature flags available to use.
Usage
// Create SDL3 window:
let sdl = init.unwrap;
let video = sdl.video.unwrap;
let window = video.window.build.unwrap;
// Create egui renderer:
let mut egui = new;
let mut event_pump = sdl.event_pump.unwrap;
loop
To get started, create an EguiGlow or EguiCanvas or EguiWgpu instance to manage rendering. Pass SDL3 events to on_event, then call run and paint each frame. For event handling only, you can use the State type.
Examples are available in the examples/ directory. To run the canvas example: