Skip to main content

Crate egui_sdl3

Crate egui_sdl3 

Source
Expand description

§egui-sdl3

Integration between egui and sdl3.

§Features

  • Translate SDL3 events into egui events.
  • Handle egui::PlatformOutput (clipboard, cursor updates, links).
  • Render with OpenGL via glow (glow-backend feature).
  • Render with the SDL3 software renderer via sdl3::render::Canvas (canvas-backend feature).

§Usage

// Create SDL3 window:
let sdl = sdl3::init().unwrap();
let video = sdl.video().unwrap();
let window = video.window("Egui SDL3 Canvas", 800, 600).build().unwrap();
// Create egui renderer:
let mut egui = egui_sdl3::EguiCanvas::new(window);
let mut event_pump = sdl.event_pump().unwrap();
loop {
   // Feed SDL3 events into egui:
   for event in event_pump.poll_iter() {
       egui.on_event(&event);
   }
   // Call `run` + `paint` each frame:
   egui.run(|ctx: &egui::Context| {});
   egui.paint();
   egui.present();
   std::thread::sleep(std::time::Duration::from_secs_f64(1.0 / 60.0));
}

Re-exports§

pub use canvas::EguiCanvas;
pub use egui;
pub use egui_glow;
pub use sdl3;
pub use glow::*;
pub use state::*;

Modules§

canvas
Integration between egui and SDL3’s sdl3::render::Canvas API.
glow
Integration between egui and glow for SDL3 applications.
state
State management for egui + SDL3 integration.

Structs§

EguiRunOutput
The results of running one frame of egui.