Skip to content

Commit

Permalink
Merge pull request Rust-SDL2#740 from wmedrano/master
Browse files Browse the repository at this point in the history
* Implement full debug for Event
* Implement Debug for MouseState
  • Loading branch information
Cobrand authored Jan 3, 2018
2 parents 8a92843 + 6e7a673 commit 7317e36
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 48 deletions.
48 changes: 1 addition & 47 deletions src/sdl2/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ impl WindowEvent {

}

#[derive(Clone, PartialEq)]
#[derive(Clone, PartialEq, Debug)]
/// Different event types.
pub enum Event {
Quit { timestamp: u32 },
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/sdl2/mouse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7317e36

Please sign in to comment.