egui-tetra

Crates.ioegui-tetra
lib.rsegui-tetra
version0.3.0
sourcesrc
created_at2021-06-26 20:39:41.037732
updated_at2022-01-07 18:23:10.897614
descriptionegui integration for Tetra
homepage
repositoryhttps://github.com/tesselode/egui-tetra
max_upload_size
id415264
size66,182
(tesselode)

documentation

README

egui-tetra

crates.io | docs

egui-tetra is a library that helps integrate egui, an immediate mode GUI library, with Tetra, a 2D game framework.

Basic example

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)))
}

License

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.

Commit count: 37

cargo fmt