Skip to main content

GameApp

Trait GameApp 

Source
pub trait GameApp: 'static {
    type Action: GameAction;

    // Required methods
    fn init(ctx: &mut Context<Self::Action>) -> Self;
    fn update(&mut self, ctx: &mut Context<Self::Action>);
    fn render(&mut self, ctx: &mut Context<Self::Action>);

    // Provided methods
    fn window_title() -> &'static str { ... }
    fn window_icon() -> Option<&'static [u8]> { ... }
    fn wasm_ready_event() -> Option<&'static str> { ... }
    fn internal_resolution() -> (u32, u32) { ... }
    fn fixed_update(
        &mut self,
        _ctx: &mut Context<Self::Action>,
        _fixed_time: &FixedTime,
    ) { ... }
    fn ui(
        &mut self,
        _egui_ctx: &Context,
        _ctx: &mut Context<Self::Action>,
        _scene_params: &mut SceneParams,
    ) { ... }
}

Required Associated Types§

Required Methods§

Source

fn init(ctx: &mut Context<Self::Action>) -> Self

Source

fn update(&mut self, ctx: &mut Context<Self::Action>)

Source

fn render(&mut self, ctx: &mut Context<Self::Action>)

Provided Methods§

Source

fn window_title() -> &'static str

Source

fn window_icon() -> Option<&'static [u8]>

Source

fn wasm_ready_event() -> Option<&'static str>

Source

fn internal_resolution() -> (u32, u32)

Source

fn fixed_update( &mut self, _ctx: &mut Context<Self::Action>, _fixed_time: &FixedTime, )

Source

fn ui( &mut self, _egui_ctx: &Context, _ctx: &mut Context<Self::Action>, _scene_params: &mut SceneParams, )

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§