@@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
22
33use crate :: Direction ;
44
5- use super :: { EventSource , GamepadControlEvent , GamepadEvent , KeyEvent , MouseEvent } ;
5+ use super :: { EventSource , GamepadEvent , KeyEvent , MouseEvent } ;
66
77/// A user input event, as generated by the new frontend (LUNA).
88#[ derive( Debug , Serialize , Deserialize , PartialEq , Clone ) ]
@@ -33,11 +33,7 @@ impl InputEvent {
3333 pub fn left_direction ( & self ) -> Option < Direction > {
3434 match self {
3535 InputEvent :: Key ( key) => key. wasd_direction ( ) ,
36- InputEvent :: Gamepad ( gamepad) => match & gamepad. control {
37- GamepadControlEvent :: Button ( button) => button. d_pad_direction ( ) ,
38- GamepadControlEvent :: Axis2D ( axis2d) if axis2d. index == 0 => axis2d. direction ( ) ,
39- _ => None ,
40- } ,
36+ InputEvent :: Gamepad ( gamepad) => gamepad. left_direction ( ) ,
4137 _ => None ,
4238 }
4339 }
@@ -47,10 +43,7 @@ impl InputEvent {
4743 pub fn right_direction ( & self ) -> Option < Direction > {
4844 match self {
4945 InputEvent :: Key ( key) => key. arrow_direction ( ) ,
50- InputEvent :: Gamepad ( gamepad) => match & gamepad. control {
51- GamepadControlEvent :: Axis2D ( axis2d) if axis2d. index == 1 => axis2d. direction ( ) ,
52- _ => None ,
53- } ,
46+ InputEvent :: Gamepad ( gamepad) => gamepad. right_direction ( ) ,
5447 _ => None ,
5548 }
5649 }
0 commit comments