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§

source

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.

source

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.

Provided Methods§

source

fn resize_framebuffer(&mut self)

source

fn resume(&mut self)

source

fn suspend(&mut self)

source

fn run(&mut self, logical_size: [f32; 2]) -> Option<(PlatformOutput, Duration)>

Implementors§