Trait egui_backend::UserApp
source · pub trait UserApp {
type UserGfxBackend: GfxBackend;
type UserWindowBackend: WindowBackend;
// Required methods
fn get_all(
&mut self
) -> (&mut Self::UserWindowBackend, &mut Self::UserGfxBackend, &Context);
fn gui_run(&mut self);
// Provided methods
fn resize_framebuffer(&mut self) { ... }
fn resume(&mut self) { ... }
fn suspend(&mut self) { ... }
fn run(
&mut self,
logical_size: [f32; 2]
) -> Option<(PlatformOutput, Duration)> { ... }
}
Expand description
This is the trait most users care about.
Just have a struct with WindowBackend, GfxBackend and egui context as fields.
and implmenet the get_all
and gui_run
fn for a simple app.
or you can overload the run
fn for more advanced stuff like filtering input events etc..
Required Associated Types§
Required Methods§
sourcefn get_all(
&mut self
) -> (&mut Self::UserWindowBackend, &mut Self::UserGfxBackend, &Context)
fn get_all( &mut self ) -> (&mut Self::UserWindowBackend, &mut Self::UserGfxBackend, &Context)
A shortcut function to get windodw, gfx backends as well as egui context.
Primarily used to provide default implementations of resize_framebuffer
, resume
, suspend
and run
fns.
sourcefn gui_run(&mut self)
fn gui_run(&mut self)
This is the only function user needs to implement. this function will be called every frame by the default implementation of run
fn.
Just use the egui context to build the user interface, and after this function is called, run
fn default impl will take care of drawing egui.