-
-
Save sfackler/8234365 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub trait ApplicationDelegate { | |
fn application_did_quit(&mut self, _timestamp: u32) {} | |
} | |
pub struct MouseMotionEventInfo; | |
pub struct MouseButtonEventInfo; | |
pub struct MouseWheelEventInfo; | |
pub trait MouseDelegate { | |
fn mouse_did_move(&mut self, _info: &MouseMotionEventInfo) {} | |
fn mouse_did_click(&mut self, _info: &MouseButtonEventInfo) {} | |
fn mouse_did_scroll(&mut self, _info: &MouseWheelEventInfo) {} | |
} | |
pub struct NullDelegate; | |
impl ApplicationDelegate for NullDelegate {} | |
impl MouseDelegate for NullDelegate {} | |
impl NullDelegate { | |
pub fn as_app<'a>(&'a mut self) -> &'a mut ApplicationDelegate { | |
self as &mut ApplicationDelegate | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment