[](https://github.com/mxmgorin/egui-sdl2/actions)
[](https://deps.rs/repo/github/mxmgorin/egui-sdl2)
[](https://crates.io/crates/egui-sdl2)
[](https://docs.rs/egui-sdl2)


# egui-sdl2
This crate provides integration between [`egui`](https://github.com/emilk/egui) and [`sdl2`](https://github.com/Rust-SDL2/rust-sdl2). It also includes optional [`glow`](https://crates.io/crates/glow) support for rendering. Implementation follows the design of the official egui-winit and egui_glow crates, using them as references.
Features include:
- Translation of sdl2 events to egui.
- Handling egui's PlatformOutput (clipboard, cursor updates, opening links — optional via `links` feature).
- Rendering egui via glow (optional via `glow-backend`)
Both `egui` and `sdl2` are re-exported for convenience. The `sdl2` re-export includes all feature flags available to use.
## Usage
To get started, create an `EguiGlow` instance to handle rendering with `glow`, provide it with events, and then call `run` and `paint`. Alternatively, create a `State` instance if you only need event handling. Examples are available in the [examples/](https://github.com/mxmgorin/egui-sdl2/tree/main/examples/) directory. You can run the “hello world” example with:
```sh
cargo run --example hello_world
```