{"id":20903319,"url":"https://github.com/NemuiSen/ggegui","last_synced_at":"2025-05-13T04:33:09.522Z","repository":{"id":39657167,"uuid":"390086277","full_name":"NemuiSen/ggegui","owner":"NemuiSen","description":"A simple implementation of egui for ggez","archived":false,"fork":false,"pushed_at":"2024-07-20T18:01:46.000Z","size":135,"stargazers_count":52,"open_issues_count":4,"forks_count":29,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-03T12:36:49.927Z","etag":null,"topics":["egui","ggez","rust-lang"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NemuiSen.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-27T18:23:28.000Z","updated_at":"2025-03-25T19:01:06.000Z","dependencies_parsed_at":"2023-12-02T15:22:11.832Z","dependency_job_id":"1ce124cb-4287-403b-976e-a0595d7b50a1","html_url":"https://github.com/NemuiSen/ggegui","commit_stats":{"total_commits":76,"total_committers":18,"mean_commits":4.222222222222222,"dds":0.4078947368421053,"last_synced_commit":"e7296f6ada8f07af6fbf0ae1188542aede306420"},"previous_names":["nemuisen/ggez-egui"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NemuiSen%2Fggegui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NemuiSen%2Fggegui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NemuiSen%2Fggegui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NemuiSen%2Fggegui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NemuiSen","download_url":"https://codeload.github.com/NemuiSen/ggegui/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253877265,"owners_count":21977632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["egui","ggez","rust-lang"],"created_at":"2024-11-18T13:12:30.638Z","updated_at":"2025-05-13T04:33:07.901Z","avatar_url":"https://github.com/NemuiSen.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![crates.io](https://img.shields.io/crates/v/ggegui)](https://crates.io/crates/ggegui)\n[![docs.rs](https://img.shields.io/docsrs/ggegui)](https://docs.rs/ggegui/)\n# ggegui\nAn [egui](https://github.com/emilk/egui/) implementation for the [ggez](https://ggez.rs/) game framework\n\n## Ultra minimal example\n```rust\nuse ggegui::{egui, Gui};\nuse ggez::{\n\tContextBuilder, Context, GameResult, glam,\n\tevent::{ self, EventHandler}, \n\tgraphics::{ self, DrawParam, Color }\n};\n\nfn main() {\n\tlet (mut ctx, event_loop) = ContextBuilder::new(\"game_id\", \"author\").build().unwrap();\n\tlet state = State::new(\u0026mut ctx);\n\tevent::run(ctx, event_loop, state);\n}\n\nstruct State {\n\tgui: Gui,\n} \n\nimpl State {\n\tpub fn new(ctx: \u0026mut Context) -\u003e Self {\n\t\tSelf { \n\t\t\tgui: Gui::new(ctx),\n\t\t}\n\t} \n} \n\nimpl EventHandler for State {\n\tfn update(\u0026mut self, ctx: \u0026mut Context) -\u003e GameResult {\n\t\tlet gui_ctx = self.gui.ctx();\n\n\t\tegui::Window::new(\"Title\").show(\u0026gui_ctx, |ui| {\n\t\t\tui.label(\"label\");\n\t\t\tif ui.button(\"button\").clicked() {\n\t\t\t\tprintln!(\"button clicked\");\n\t\t\t}\n\t\t});\n\t\tself.gui.update(ctx);\n\t\tOk(())\n\t}\n\n\tfn draw(\u0026mut self, ctx: \u0026mut Context) -\u003e GameResult {\n\t\tlet mut canvas = graphics::Canvas::from_frame(ctx, Color::BLACK);\n\t\tcanvas.draw(\n\t\t\t\u0026self.gui, \n\t\t\tDrawParam::default().dest(glam::Vec2::ZERO),\n\t\t);\n\t\tcanvas.finish(ctx)\n\t}\n}\n```\n\u003e **__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::text_input_event` inside of `EventHandler::text_input_event` like this `self.gui.input.text_input_event(character)`, this also applies to `Input::mouse_wheel_event` and `Input::resize_event`, you just call then inside of their respective functions exposed by `EventHandler`.\n\nthere are a few [examples](./examples/) to show how to use this implementation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNemuiSen%2Fggegui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNemuiSen%2Fggegui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNemuiSen%2Fggegui/lists"}