Macro ascii_forge::event
source · macro_rules! event { ($window:expr, $event_type:pat => $($closure:tt)*) => { ... }; }
Expand description
A macro that allows you to quickly check an event based off of a pattern Takes in the window, a pattern for the if let statement, and finally a closure. This closure could be anything that returns a bool.
Underneath, the event! macro runs an if let on your pattern checking for any of the Events to be true from your given closure. Example
event!(window, Event::Key(e) => e.code == KeyCode::Char('q'));