Commit 27b555ee authored by Rahix's avatar Rahix 🦀
Browse files

gamestate: Cleanup EventHandlers type signatures

Add a type alias for the handler closure type to make the EventHandlers
code more readable.
parent 95368ee0
......@@ -71,13 +71,10 @@ pub enum Event<'a> {
Cheat(crate::cheats::CheatCommand),
}
pub type HandlerClosure = closure::Closure<dyn FnMut(wasm_bindgen::JsValue)>;
struct EventHandlers {
pub mouse_handlers:
std::collections::HashMap<String, closure::Closure<dyn FnMut(wasm_bindgen::JsValue)>>,
pub key_handlers: Option<(
closure::Closure<dyn FnMut(wasm_bindgen::JsValue)>,
closure::Closure<dyn FnMut(wasm_bindgen::JsValue)>,
)>,
pub mouse_handlers: std::collections::HashMap<String, HandlerClosure>,
pub key_handlers: Option<(HandlerClosure, HandlerClosure)>,
}
impl EventHandlers {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment