Crates.io | egui-tetra2 |
lib.rs | egui-tetra2 |
version | 0.4.1 |
source | src |
created_at | 2024-06-03 06:45:27.875938 |
updated_at | 2024-06-03 06:57:37.189356 |
description | egui integration for Tetra |
homepage | |
repository | https://github.com/trevyn/egui-tetra2 |
max_upload_size | |
id | 1259766 |
size | 98,310 |
This is an up-to-date and maintained fork of tesselode/egui-tetra
, which has been archived. Issues and PRs welcome.
egui-tetra2 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_tetra2::State<Box<dyn Error>> for MainState {
fn ui(
&mut self,
_ctx: &mut tetra::Context,
egui_ctx: &egui::Context,
) -> Result<(), Box<dyn Error>> {
egui::CentralPanel::default().show(egui_ctx, |_ui| {
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)
.show_mouse(true)
.build()?
.run(|_| Ok(egui_tetra2::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.