4 releases (2 breaking)
new 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 |
|
#233 in GUI
244 downloads per month
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
~641K SLoC