Merge pull request #740 from wmedrano/master

* Implement full debug for Event
* Implement Debug for MouseState
This commit is contained in:
Cobrand
2018-01-02 18:36:04 -08:00
committed by GitHub
2 changed files with 2 additions and 48 deletions
+1 -47
View File
@@ -451,7 +451,7 @@ impl WindowEvent {
}
#[derive(Clone, PartialEq)]
#[derive(Clone, PartialEq, Debug)]
/// Different event types.
pub enum Event {
Quit { timestamp: u32 },
@@ -709,52 +709,6 @@ pub enum Event {
}
}
impl ::std::fmt::Debug for Event {
fn fmt(&self, out: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
out.write_str(match *self {
Event::Quit{..} => "Event::Quit",
Event::AppTerminating{..} => "Event::AppTerminating",
Event::AppLowMemory{..} => "Event::AppLowMemory",
Event::AppWillEnterBackground{..} => "Event::AppWillEnterBackground",
Event::AppDidEnterBackground{..} => "Event::AppDidEnterBackground",
Event::AppWillEnterForeground{..} => "Event::AppWillEnterForeground",
Event::AppDidEnterForeground{..} => "Event::AppDidEnterForeground",
Event::Window{..} => "Event::Window",
Event::KeyDown{..} => "Event::KeyDown",
Event::KeyUp{..} => "Event::KeyUp",
Event::TextEditing{..} => "Event::TextEditing",
Event::TextInput{..} => "Event::TextInput",
Event::MouseMotion{..} => "Event::MouseMotion",
Event::MouseButtonDown{..} => "Event::MouseButtonDown",
Event::MouseButtonUp{..} => "Event::MouseButtonUp",
Event::MouseWheel{..} => "Event::MouseWheel",
Event::JoyAxisMotion{..} => "Event::JoyAxisMotion",
Event::JoyBallMotion{..} => "Event::JoyBallMotion",
Event::JoyHatMotion{..} => "Event::JoyHatMotion",
Event::JoyButtonDown{..} => "Event::JoyButtonDown",
Event::JoyButtonUp{..} => "Event::JoyButtonUp",
Event::JoyDeviceAdded{..} => "Event::JoyDeviceAdded",
Event::JoyDeviceRemoved{..} => "Event::JoyDeviceRemoved",
Event::ControllerAxisMotion{..} => "Event::ControllerAxisMotion",
Event::ControllerButtonDown{..} => "Event::ControllerButtonDown",
Event::ControllerButtonUp{..} => "Event::ControllerButtonUp",
Event::ControllerDeviceAdded{..} => "Event::ControllerDeviceAdded",
Event::ControllerDeviceRemoved{..} => "Event::ControllerDeviceRemoved",
Event::ControllerDeviceRemapped{..} => "Event::ControllerDeviceRemapped",
Event::FingerDown{..} => "Event::FingerDown",
Event::FingerUp{..} => "Event::FingerUp",
Event::FingerMotion{..} => "Event::FingerMotion",
Event::DollarGesture{..} => "Event::DollarGesture",
Event::DollarRecord{..} => "Event::DollarRecord",
Event::MultiGesture{..} => "Event::MultiGesture",
Event::ClipboardUpdate{..} => "Event::ClipboardUpdate",
Event::DropFile{..} => "Event::DropFile",
Event::User{..} => "Event::User",
Event::Unknown{..} => "Event::Unknown",
})
}
}
/// Helper function to make converting scancodes
/// and keycodes to primitive `SDL_Keysym` types.
fn mk_keysym<S, K>(scancode: S,
+1 -1
View File
@@ -151,7 +151,7 @@ impl MouseButton {
}
}
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct MouseState {
mouse_state: u32,
x: i32,