Trait egui_tetra::State[][src]

pub trait State<E: From<Error> = Error> {
    fn ui(&mut self, ctx: &mut Context, egui_ctx: &CtxRef) -> Result<(), E> { ... }
fn update(&mut self, ctx: &mut Context, egui_ctx: &CtxRef) -> Result<(), E> { ... }
fn draw(&mut self, ctx: &mut Context, egui_ctx: &CtxRef) -> Result<(), E> { ... }
fn event(
        &mut self,
        ctx: &mut Context,
        egui_ctx: &CtxRef,
        event: Event
    ) -> Result<(), E> { ... } }
Expand description

A trait analogous to tetra::State, but with the addition of a ui callback and an egui_ctx argument in the other callbacks.

You can use a type implementing this trait as your main game state by wrapping it with a StateWrapper and passing the wrapper to tetra::Context::run.

Provided methods

Called when it is time for the game to construct a GUI.

This is called at the beginning of the game loop, but the GUI is not drawn until the end of the game loop.

Called when it is time for the game to update.

Called when it is time for the game to be drawn.

Called when a window or input event occurs.

Mouse and keyboard input events will not be received if the GUI is using the mouse or keyboard, respectively.

Implementors