Skip to main content

AnimationEventExt

Trait AnimationEventExt 

Source
pub trait AnimationEventExt {
    // Required methods
    fn register_animation_trigger<T: AnimationTriggerType>(
        &mut self,
    ) -> &mut Self
       where for<'a> <T as Event>::Trigger<'a>: Default;
    fn register_animation_window<T: AnimationWindowType>(&mut self) -> &mut Self
       where for<'a> <T as Event>::Trigger<'a>: Default;
}
Expand description

Extension trait for registering animation trigger and window types.

§Example

use bevy::prelude::*;
use bevy_map_animation::{SpriteAnimationPlugin, AnimationEventExt};

App::new()
    .add_plugins(SpriteAnimationPlugin)
    .register_animation_trigger::<AttackHitbox>()
    .register_animation_window::<ComboWindow>()
    .run();

Required Methods§

Source

fn register_animation_trigger<T: AnimationTriggerType>(&mut self) -> &mut Self
where for<'a> <T as Event>::Trigger<'a>: Default,

Register a custom trigger type for type-safe event handling

Source

fn register_animation_window<T: AnimationWindowType>(&mut self) -> &mut Self
where for<'a> <T as Event>::Trigger<'a>: Default,

Register a custom window type for type-safe event handling

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.

Implementations on Foreign Types§

Source§

impl AnimationEventExt for App

Source§

fn register_animation_trigger<T: AnimationTriggerType>(&mut self) -> &mut Self
where for<'a> <T as Event>::Trigger<'a>: Default,

Source§

fn register_animation_window<T: AnimationWindowType>(&mut self) -> &mut Self
where for<'a> <T as Event>::Trigger<'a>: Default,

Implementors§