wip: big flat pt.3, testing standalone tui

This commit is contained in:
🪞👃🪞 2024-12-30 18:20:36 +01:00
parent a5628fb663
commit cb680ab096
4 changed files with 189 additions and 139 deletions

View file

@ -1,6 +1,11 @@
use crate::*;
use std::sync::{Arc, Mutex, RwLock};
/// Handle input
pub trait Handle<E: Engine>: Send + Sync {
fn handle (&mut self, context: &E::Input) -> Perhaps<E::Handled>;
}
/// Current input state
pub trait Input<E: Engine> {
/// Type of input event
@ -23,11 +28,6 @@ pub trait Input<E: Engine> {
}
}
/// Handle input
pub trait Handle<E: Engine>: Send + Sync {
fn handle (&mut self, context: &E::Input) -> Perhaps<E::Handled>;
}
impl<E: Engine, H: Handle<E>> Handle<E> for &mut H {
fn handle (&mut self, context: &E::Input) -> Perhaps<E::Handled> {
(*self).handle(context)