@@ -35,153 +35,153 @@ pub fn default_input_action_map() -> InputMap<Action> {
35
35
use leafwing_input_manager:: user_input:: InputKind :: * ;
36
36
let mouse_input_map = InputMap :: new ( [
37
37
(
38
- UserInput :: Single ( Mouse ( MouseButton :: Other ( 1 ) ) ) ,
39
38
Action :: Undo ,
39
+ UserInput :: Single ( Mouse ( MouseButton :: Other ( 1 ) ) ) ,
40
40
) ,
41
41
(
42
- UserInput :: Single ( Mouse ( MouseButton :: Other ( 2 ) ) ) ,
43
42
Action :: Redo ,
43
+ UserInput :: Single ( Mouse ( MouseButton :: Other ( 2 ) ) ) ,
44
44
) ,
45
45
(
46
- UserInput :: Single ( MouseWheel ( MouseWheelDirection :: Down ) ) ,
47
46
Action :: ZoomOut ,
47
+ UserInput :: Single ( MouseWheel ( MouseWheelDirection :: Down ) ) ,
48
48
) ,
49
49
(
50
- UserInput :: Single ( MouseWheel ( MouseWheelDirection :: Up ) ) ,
51
50
Action :: ZoomIn ,
51
+ UserInput :: Single ( MouseWheel ( MouseWheelDirection :: Up ) ) ,
52
52
) ,
53
53
] ) ;
54
54
let keyboard_input_map = InputMap :: new ( [
55
- ( UserInput :: Single ( Keyboard ( KeyCode :: W ) ) , Action :: MoveUp ) ,
56
- ( UserInput :: Single ( Keyboard ( KeyCode :: S ) ) , Action :: MoveDown ) ,
57
- ( UserInput :: Single ( Keyboard ( KeyCode :: A ) ) , Action :: MoveLeft ) ,
58
- ( UserInput :: Single ( Keyboard ( KeyCode :: D ) ) , Action :: MoveRight ) ,
59
- ( UserInput :: Single ( Keyboard ( KeyCode :: Up ) ) , Action :: MoveUp ) ,
60
- ( UserInput :: Single ( Keyboard ( KeyCode :: Down ) ) , Action :: MoveDown ) ,
61
- ( UserInput :: Single ( Keyboard ( KeyCode :: Left ) ) , Action :: MoveLeft ) ,
62
- (
63
- UserInput :: Single ( Keyboard ( KeyCode :: Right ) ) ,
55
+ ( Action :: MoveUp , UserInput :: Single ( PhysicalKey ( KeyCode :: KeyW ) ) ) ,
56
+ ( Action :: MoveDown , UserInput :: Single ( PhysicalKey ( KeyCode :: KeyS ) ) ) ,
57
+ ( Action :: MoveLeft , UserInput :: Single ( PhysicalKey ( KeyCode :: KeyA ) ) ) ,
58
+ ( Action :: MoveRight , UserInput :: Single ( PhysicalKey ( KeyCode :: KeyD ) ) ) ,
59
+ ( Action :: MoveUp , UserInput :: Single ( PhysicalKey ( KeyCode :: ArrowUp ) ) ) ,
60
+ ( Action :: MoveDown , UserInput :: Single ( PhysicalKey ( KeyCode :: ArrowDown ) ) ) ,
61
+ ( Action :: MoveLeft , UserInput :: Single ( PhysicalKey ( KeyCode :: ArrowLeft ) ) ) ,
62
+ (
64
63
Action :: MoveRight ,
64
+ UserInput :: Single ( PhysicalKey ( KeyCode :: ArrowRight ) ) ,
65
65
) ,
66
66
(
67
- UserInput :: Chord ( vec ! [ Keyboard ( KeyCode :: ControlLeft ) , Keyboard ( KeyCode :: Z ) ] ) ,
68
67
Action :: Undo ,
68
+ UserInput :: Chord ( vec ! [ PhysicalKey ( KeyCode :: ControlLeft ) , PhysicalKey ( KeyCode :: KeyZ ) ] ) ,
69
69
) ,
70
70
(
71
+ Action :: Redo ,
71
72
UserInput :: Chord ( vec ! [
72
- Keyboard ( KeyCode :: ControlLeft ) ,
73
- Keyboard ( KeyCode :: ShiftLeft ) ,
74
- Keyboard ( KeyCode :: Z ) ,
73
+ PhysicalKey ( KeyCode :: ControlLeft ) ,
74
+ PhysicalKey ( KeyCode :: ShiftLeft ) ,
75
+ PhysicalKey ( KeyCode :: KeyZ ) ,
75
76
] ) ,
76
- Action :: Redo ,
77
77
) ,
78
78
(
79
- UserInput :: Single ( Keyboard ( KeyCode :: Escape ) ) ,
80
79
Action :: ResetLevel ,
80
+ UserInput :: Single ( PhysicalKey ( KeyCode :: Escape ) ) ,
81
81
) ,
82
82
(
83
- UserInput :: Single ( Keyboard ( KeyCode :: BracketRight ) ) ,
84
83
Action :: NextLevel ,
84
+ UserInput :: Single ( PhysicalKey ( KeyCode :: BracketRight ) ) ,
85
85
) ,
86
86
(
87
- UserInput :: Single ( Keyboard ( KeyCode :: BracketLeft ) ) ,
88
87
Action :: PreviousLevel ,
88
+ UserInput :: Single ( PhysicalKey ( KeyCode :: BracketLeft ) ) ,
89
89
) ,
90
90
(
91
+ Action :: NextUnsolvedLevel ,
91
92
UserInput :: Chord ( vec ! [
92
- Keyboard ( KeyCode :: ControlLeft ) ,
93
- Keyboard ( KeyCode :: BracketRight ) ,
93
+ PhysicalKey ( KeyCode :: ControlLeft ) ,
94
+ PhysicalKey ( KeyCode :: BracketRight ) ,
94
95
] ) ,
95
- Action :: NextUnsolvedLevel ,
96
96
) ,
97
97
(
98
+ Action :: PreviousUnsolvedLevel ,
98
99
UserInput :: Chord ( vec ! [
99
- Keyboard ( KeyCode :: ControlLeft ) ,
100
- Keyboard ( KeyCode :: BracketLeft ) ,
100
+ PhysicalKey ( KeyCode :: ControlLeft ) ,
101
+ PhysicalKey ( KeyCode :: BracketLeft ) ,
101
102
] ) ,
102
- Action :: PreviousUnsolvedLevel ,
103
103
) ,
104
- ( UserInput :: Single ( Keyboard ( KeyCode :: Equals ) ) , Action :: ZoomIn ) ,
105
- ( UserInput :: Single ( Keyboard ( KeyCode :: Minus ) ) , Action :: ZoomOut ) ,
104
+ ( Action :: ZoomIn , UserInput :: Single ( PhysicalKey ( KeyCode :: Equal ) ) ) ,
105
+ ( Action :: ZoomOut , UserInput :: Single ( PhysicalKey ( KeyCode :: Minus ) ) ) ,
106
106
(
107
- UserInput :: Single ( Keyboard ( KeyCode :: I ) ) ,
108
107
Action :: ToggleInstantMove ,
108
+ UserInput :: Single ( PhysicalKey ( KeyCode :: KeyI ) ) ,
109
109
) ,
110
110
(
111
- UserInput :: Single ( Keyboard ( KeyCode :: P ) ) ,
112
111
Action :: ToggleAutomaticSolution ,
112
+ UserInput :: Single ( PhysicalKey ( KeyCode :: KeyP ) ) ,
113
113
) ,
114
114
(
115
- UserInput :: Single ( Keyboard ( KeyCode :: F11 ) ) ,
116
115
Action :: ToggleFullscreen ,
116
+ UserInput :: Single ( PhysicalKey ( KeyCode :: F11 ) ) ,
117
117
) ,
118
118
(
119
- UserInput :: Chord ( vec ! [ Keyboard ( KeyCode :: ControlLeft ) , Keyboard ( KeyCode :: V ) ] ) ,
120
119
Action :: ImportLevelsFromClipboard ,
120
+ UserInput :: Chord ( vec ! [ PhysicalKey ( KeyCode :: ControlLeft ) , PhysicalKey ( KeyCode :: KeyV ) ] ) ,
121
121
) ,
122
122
(
123
- UserInput :: Chord ( vec ! [ Keyboard ( KeyCode :: ControlLeft ) , Keyboard ( KeyCode :: C ) ] ) ,
124
123
Action :: ExportLevelToClipboard ,
124
+ UserInput :: Chord ( vec ! [ PhysicalKey ( KeyCode :: ControlLeft ) , PhysicalKey ( KeyCode :: KeyC ) ] ) ,
125
125
) ,
126
- // Keyboard (Vim)
127
- ( UserInput :: Single ( Keyboard ( KeyCode :: K ) ) , Action :: MoveUp ) ,
128
- ( UserInput :: Single ( Keyboard ( KeyCode :: J ) ) , Action :: MoveDown ) ,
129
- ( UserInput :: Single ( Keyboard ( KeyCode :: H ) ) , Action :: MoveLeft ) ,
130
- ( UserInput :: Single ( Keyboard ( KeyCode :: L ) ) , Action :: MoveRight ) ,
131
- ( UserInput :: Single ( Keyboard ( KeyCode :: U ) ) , Action :: Undo ) ,
126
+ // PhysicalKey (Vim)
127
+ ( Action :: MoveUp , UserInput :: Single ( PhysicalKey ( KeyCode :: KeyK ) ) ) ,
128
+ ( Action :: MoveDown , UserInput :: Single ( PhysicalKey ( KeyCode :: KeyJ ) ) ) ,
129
+ ( Action :: MoveLeft , UserInput :: Single ( PhysicalKey ( KeyCode :: KeyH ) ) ) ,
130
+ ( Action :: MoveRight , UserInput :: Single ( PhysicalKey ( KeyCode :: KeyL ) ) ) ,
131
+ ( Action :: Undo , UserInput :: Single ( PhysicalKey ( KeyCode :: KeyU ) ) ) ,
132
132
(
133
- UserInput :: Chord ( vec ! [ Keyboard ( KeyCode :: ControlLeft ) , Keyboard ( KeyCode :: R ) ] ) ,
134
133
Action :: Redo ,
134
+ UserInput :: Chord ( vec ! [ PhysicalKey ( KeyCode :: ControlLeft ) , PhysicalKey ( KeyCode :: KeyR ) ] ) ,
135
135
) ,
136
136
] ) ;
137
137
let gamepad_input_map = InputMap :: new ( [
138
138
(
139
- UserInput :: Single ( GamepadButton ( GamepadButtonType :: DPadUp ) ) ,
140
139
Action :: MoveUp ,
140
+ UserInput :: Single ( GamepadButton ( GamepadButtonType :: DPadUp ) ) ,
141
141
) ,
142
142
(
143
- UserInput :: Single ( GamepadButton ( GamepadButtonType :: DPadDown ) ) ,
144
143
Action :: MoveDown ,
144
+ UserInput :: Single ( GamepadButton ( GamepadButtonType :: DPadDown ) ) ,
145
145
) ,
146
146
(
147
- UserInput :: Single ( GamepadButton ( GamepadButtonType :: DPadLeft ) ) ,
148
147
Action :: MoveLeft ,
148
+ UserInput :: Single ( GamepadButton ( GamepadButtonType :: DPadLeft ) ) ,
149
149
) ,
150
150
(
151
- UserInput :: Single ( GamepadButton ( GamepadButtonType :: DPadRight ) ) ,
152
151
Action :: MoveRight ,
152
+ UserInput :: Single ( GamepadButton ( GamepadButtonType :: DPadRight ) ) ,
153
153
) ,
154
154
(
155
- UserInput :: Single ( GamepadButton ( GamepadButtonType :: East ) ) ,
156
155
Action :: Undo ,
156
+ UserInput :: Single ( GamepadButton ( GamepadButtonType :: East ) ) ,
157
157
) ,
158
158
(
159
- UserInput :: Single ( GamepadButton ( GamepadButtonType :: South ) ) ,
160
159
Action :: Redo ,
160
+ UserInput :: Single ( GamepadButton ( GamepadButtonType :: South ) ) ,
161
161
) ,
162
162
(
163
- UserInput :: Single ( GamepadButton ( GamepadButtonType :: RightTrigger ) ) ,
164
163
Action :: NextLevel ,
164
+ UserInput :: Single ( GamepadButton ( GamepadButtonType :: RightTrigger ) ) ,
165
165
) ,
166
166
(
167
- UserInput :: Single ( GamepadButton ( GamepadButtonType :: LeftTrigger ) ) ,
168
167
Action :: PreviousLevel ,
168
+ UserInput :: Single ( GamepadButton ( GamepadButtonType :: LeftTrigger ) ) ,
169
169
) ,
170
170
(
171
- UserInput :: Single ( GamepadButton ( GamepadButtonType :: RightTrigger2 ) ) ,
172
171
Action :: ZoomIn ,
172
+ UserInput :: Single ( GamepadButton ( GamepadButtonType :: RightTrigger2 ) ) ,
173
173
) ,
174
174
(
175
- UserInput :: Single ( GamepadButton ( GamepadButtonType :: LeftTrigger2 ) ) ,
176
175
Action :: ZoomOut ,
176
+ UserInput :: Single ( GamepadButton ( GamepadButtonType :: LeftTrigger2 ) ) ,
177
177
) ,
178
178
(
179
- UserInput :: Single ( GamepadButton ( GamepadButtonType :: West ) ) ,
180
179
Action :: ToggleInstantMove ,
180
+ UserInput :: Single ( GamepadButton ( GamepadButtonType :: West ) ) ,
181
181
) ,
182
182
(
183
- UserInput :: Single ( GamepadButton ( GamepadButtonType :: North ) ) ,
184
183
Action :: ToggleAutomaticSolution ,
184
+ UserInput :: Single ( GamepadButton ( GamepadButtonType :: North ) ) ,
185
185
) ,
186
186
] ) ;
187
187
InputMap :: default ( )
0 commit comments