Crates.io | egui-tetra |
lib.rs | egui-tetra |
version | 0.3.0 |
source | src |
created_at | 2021-06-26 20:39:41.037732 |
updated_at | 2022-01-07 18:23:10.897614 |
description | egui integration for Tetra |
homepage | |
repository | https://github.com/tesselode/egui-tetra |
max_upload_size | |
id | 415264 |
size | 66,182 |
egui-tetra is a library that helps integrate egui, an immediate mode GUI library, with Tetra, a 2D game framework.
use std::error::Error;
struct MainState;
impl egui_tetra::State<Box<dyn Error>> for MainState {
fn ui(
&mut self,
ctx: &mut tetra::Context,
egui_ctx: &egui::CtxRef,
) -> Result<(), Box<dyn Error>> {
egui::Window::new("hi!").show(egui_ctx, |ui| {
ui.label("Hello world!");
});
Ok(())
}
}
fn main() -> Result<(), Box<dyn Error>> {
tetra::ContextBuilder::new("example", 800, 600)
.build()?
.run(|_| Ok(egui_tetra::StateWrapper::new(MainState)))
}
This project is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in time by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.