Skip to content

Commit 5a732fb

Browse files
authored
Merge pull request #740 from wmedrano/master
* Implement full debug for Event * Implement Debug for MouseState
2 parents 43ca1ba + 16b9fa4 commit 5a732fb

File tree

2 files changed

+2
-48
lines changed

2 files changed

+2
-48
lines changed

src/sdl2/event.rs

+1-47
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ impl WindowEvent {
451451

452452
}
453453

454-
#[derive(Clone, PartialEq)]
454+
#[derive(Clone, PartialEq, Debug)]
455455
/// Different event types.
456456
pub enum Event {
457457
Quit { timestamp: u32 },
@@ -709,52 +709,6 @@ pub enum Event {
709709
}
710710
}
711711

712-
impl ::std::fmt::Debug for Event {
713-
fn fmt(&self, out: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
714-
out.write_str(match *self {
715-
Event::Quit{..} => "Event::Quit",
716-
Event::AppTerminating{..} => "Event::AppTerminating",
717-
Event::AppLowMemory{..} => "Event::AppLowMemory",
718-
Event::AppWillEnterBackground{..} => "Event::AppWillEnterBackground",
719-
Event::AppDidEnterBackground{..} => "Event::AppDidEnterBackground",
720-
Event::AppWillEnterForeground{..} => "Event::AppWillEnterForeground",
721-
Event::AppDidEnterForeground{..} => "Event::AppDidEnterForeground",
722-
Event::Window{..} => "Event::Window",
723-
Event::KeyDown{..} => "Event::KeyDown",
724-
Event::KeyUp{..} => "Event::KeyUp",
725-
Event::TextEditing{..} => "Event::TextEditing",
726-
Event::TextInput{..} => "Event::TextInput",
727-
Event::MouseMotion{..} => "Event::MouseMotion",
728-
Event::MouseButtonDown{..} => "Event::MouseButtonDown",
729-
Event::MouseButtonUp{..} => "Event::MouseButtonUp",
730-
Event::MouseWheel{..} => "Event::MouseWheel",
731-
Event::JoyAxisMotion{..} => "Event::JoyAxisMotion",
732-
Event::JoyBallMotion{..} => "Event::JoyBallMotion",
733-
Event::JoyHatMotion{..} => "Event::JoyHatMotion",
734-
Event::JoyButtonDown{..} => "Event::JoyButtonDown",
735-
Event::JoyButtonUp{..} => "Event::JoyButtonUp",
736-
Event::JoyDeviceAdded{..} => "Event::JoyDeviceAdded",
737-
Event::JoyDeviceRemoved{..} => "Event::JoyDeviceRemoved",
738-
Event::ControllerAxisMotion{..} => "Event::ControllerAxisMotion",
739-
Event::ControllerButtonDown{..} => "Event::ControllerButtonDown",
740-
Event::ControllerButtonUp{..} => "Event::ControllerButtonUp",
741-
Event::ControllerDeviceAdded{..} => "Event::ControllerDeviceAdded",
742-
Event::ControllerDeviceRemoved{..} => "Event::ControllerDeviceRemoved",
743-
Event::ControllerDeviceRemapped{..} => "Event::ControllerDeviceRemapped",
744-
Event::FingerDown{..} => "Event::FingerDown",
745-
Event::FingerUp{..} => "Event::FingerUp",
746-
Event::FingerMotion{..} => "Event::FingerMotion",
747-
Event::DollarGesture{..} => "Event::DollarGesture",
748-
Event::DollarRecord{..} => "Event::DollarRecord",
749-
Event::MultiGesture{..} => "Event::MultiGesture",
750-
Event::ClipboardUpdate{..} => "Event::ClipboardUpdate",
751-
Event::DropFile{..} => "Event::DropFile",
752-
Event::User{..} => "Event::User",
753-
Event::Unknown{..} => "Event::Unknown",
754-
})
755-
}
756-
}
757-
758712
/// Helper function to make converting scancodes
759713
/// and keycodes to primitive `SDL_Keysym` types.
760714
fn mk_keysym<S, K>(scancode: S,

src/sdl2/mouse/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl MouseButton {
151151
}
152152
}
153153

154-
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
154+
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
155155
pub struct MouseState {
156156
mouse_state: u32,
157157
x: i32,

0 commit comments

Comments
 (0)