Crate egui_speedy2d

source ·
Expand description


egui_speedy2d is a library that helps integrate egui, an immediate mode GUI library, with speedy2d, a 2D rendering framework.


The easiest way to use egui_speedy2d is to make your main WindowHandler struct implement egui_speedy2d’s WindowHandler trait instead of speedy2d’s. This will give you access to a egui_ctx context where you can do your GUI rendering.

struct MyWindowHandler;

impl egui_speedy2d::WindowHandler for MyWindowHandler {
    fn on_draw(
        &mut self,
        helper: &mut WindowHelper,
        graphics: &mut Graphics2D,
        egui_ctx: &egui::Context,
    ) {
        egui::Window::new("Hello").show(&egui_ctx, |ui| {
            ui.label("World !");

When running the speedy2d Window, wrap your handler struct in a WindowHandler to make it compatible with Speedy2d’s speedy2d::windows::WindowHandler trait.

fn main() {
    let window = speedy2d::Window::new_centered("Speedy2D: Hello World", (640, 240)).unwrap();


pub use egui;


Wraps an egui context with features that are useful for integrating egui with Speedy2d.


A trait analogous to speedy2d::window::WindowHandler, but with the addition of a egui_ctx argument.