fennel_engine/
events.rs

1use fennel_common::events::{
2    KeyboardEvent, MouseClickEvent, MouseMotionEvent, MouseWheelEvent, WindowEventHandler,
3};
4use crate::runtime::Runtime;
5
6pub struct RuntimeHandler;
7#[async_trait::async_trait]
8impl WindowEventHandler for RuntimeHandler {
9    type Host = Runtime;
10
11    fn update(&self, _window: &mut Runtime) -> anyhow::Result<()> {
12        Ok(())
13    }
14
15    fn draw(&self, _window: &mut Runtime) -> anyhow::Result<()> {
16        Ok(())
17    }
18
19    fn key_down_event(&self, _window: &mut Runtime, _event: KeyboardEvent) -> anyhow::Result<()> {
20        Ok(())
21    }
22
23    fn key_up_event(&self, _window: &mut Runtime, _event: KeyboardEvent) -> anyhow::Result<()> {
24        Ok(())
25    }
26
27    fn mouse_motion_event(
28        &self,
29        _window: &mut Runtime,
30        _event: MouseMotionEvent,
31    ) -> anyhow::Result<()> {
32        Ok(())
33    }
34
35    fn mouse_button_down_event(
36        &self,
37        _window: &mut Runtime,
38        _event: MouseClickEvent,
39    ) -> anyhow::Result<()> {
40        Ok(())
41    }
42
43    fn mouse_button_up_event(
44        &self,
45        _window: &mut Runtime,
46        _event: MouseClickEvent,
47    ) -> anyhow::Result<()> {
48        Ok(())
49    }
50
51    fn mouse_wheel_event(
52        &self,
53        _window: &mut Runtime,
54        _event: MouseWheelEvent,
55    ) -> anyhow::Result<()> {
56        Ok(())
57    }
58}
59
60pub type BoxedEngineHandler = Box<dyn WindowEventHandler<Host = Runtime> + Send + Sync>;