NemuiSen
ggegui
Rust

A simple implementation of egui for ggez

Last updated May 5, 2026
50
Stars
32
Forks
4
Issues
0
Stars/day
Attention Score
15
Language breakdown
No language data available.
โ–ธ Files click to expand
README

crates.io docs.rs

ggegui

An egui implementation for the ggez game framework

Ultra minimal example

use ggegui::{egui, Gui};
use ggez::{
	ContextBuilder, Context, GameResult, glam,
	event::{ self, EventHandler}, 
	graphics::{ self, DrawParam, Color }
};

fn main() { let (mut ctx, eventloop) = ContextBuilder::new("gameid", "author").build().unwrap(); let state = State::new(&mut ctx); event::run(ctx, event_loop, state); }

struct State { gui: Gui, }

impl State { pub fn new(ctx: &mut Context) -> Self { Self { gui: Gui::new(ctx), } } }

impl EventHandler for State { fn update(&mut self, ctx: &mut Context) -> GameResult { let gui_ctx = self.gui.ctx();

egui::Window::new("Title").show(&gui_ctx, |ui| { ui.label("label"); if ui.button("button").clicked() { println!("button clicked"); } }); self.gui.update(ctx); Ok(()) }

fn draw(&mut self, ctx: &mut Context) -> GameResult { let mut canvas = graphics::Canvas::from_frame(ctx, Color::BLACK); canvas.draw( &self.gui, DrawParam::default().dest(glam::Vec2::ZERO), ); canvas.finish(ctx) } }

NOTE: due to how ggez is made currently there is no way to access the raw events emited by eventloop so instead to get the events using the functions and the context of EventHandler, as shown in the example of adove inside EventHandler::update is called Gui::update this function extract the information inside the context to send it to egui and draws everything. To make use of text input you must call Input::textinputevent inside of EventHandler::textinputevent like this self.gui.input.textinputevent(character), this also applies to Input::mousewheelevent and Input::resize_event, you just call then inside of their respective functions exposed by EventHandler.

there are a few examples to show how to use this implementation.

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท NemuiSen/ggegui ยท Updated daily from GitHub