feo_oop_engine/
event.rs

1//! Engine events and user defined events container.
2//! 
3use std::sync::{Arc, RwLock};
4use crate::scene::game_object::GameObject;
5use std::fmt::Display;
6
7/// A wrapper for winit events.
8/// 
9/// This enum allows for the definition of custom 
10/// events with the UserEvent enumeration constant.
11#[derive(Debug, Clone)]
12pub enum UserEvent<T: 'static + Clone + Send + Sync>{
13    RebuildSwapchain,
14    
15    Collision(Arc<RwLock<dyn GameObject>>, Arc<RwLock<dyn GameObject>>),
16
17    WinitEvent(winit::event::Event<'static, Box<UserEvent<T>>>),
18    UserEvent(T),
19    None,
20}
21
22pub trait Error: Sized + Display {}
23
24impl<T: Sized + Display> Error for T {}