4 releases (2 breaking)

0.6.0 Sep 30, 2024
0.5.1 Aug 1, 2024
0.5.0 Jul 28, 2024
0.4.1 Jun 3, 2024
0.4.0 Jun 3, 2024

#251 in GUI

Download history 131/week @ 2024-07-24 201/week @ 2024-07-31 44/week @ 2024-08-07 38/week @ 2024-08-14 28/week @ 2024-08-21 37/week @ 2024-08-28 26/week @ 2024-09-04 54/week @ 2024-09-11 42/week @ 2024-09-18 162/week @ 2024-09-25 36/week @ 2024-10-02 11/week @ 2024-10-09 4/week @ 2024-10-16

86 downloads per month

MIT/Apache

39KB
491 lines

egui-tetra2

This is an up-to-date and maintained fork of tesselode/egui-tetra, which has been archived. Issues and PRs welcome.

crates.io | docs

egui-tetra2 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_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)))
}

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.

Dependencies

~36MB
~642K SLoC