File tree Expand file tree Collapse file tree 1 file changed +5
-19
lines changed Expand file tree Collapse file tree 1 file changed +5
-19
lines changed Original file line number Diff line number Diff line change @@ -218,31 +218,17 @@ fn input_dispatch(
218
218
}
219
219
220
220
// Inputs for sending numbers to be added
221
- for k in keyboard_input. get_just_pressed ( ) {
222
- let num = match key_code {
223
- Key0 => Some ( 0 ) ,
224
- Key1 => Some ( 1 ) ,
225
- Key2 => Some ( 2 ) ,
226
- Key3 => Some ( 3 ) ,
227
- Key4 => Some ( 4 ) ,
228
- Key5 => Some ( 5 ) ,
229
- Key6 => Some ( 6 ) ,
230
- Key7 => Some ( 7 ) ,
231
- Key8 => Some ( 8 ) ,
232
- Key9 => Some ( 9 ) ,
233
- _ => None ,
234
- } ;
235
-
236
- if num. is_some ( ) {
221
+ for key_code in keyboard_input. get_just_pressed ( ) {
222
+ if ( key_code as u8 ) < 10 {
237
223
add_actions. send ( AddNumberAction {
238
- number : num. unwrap ( ) ,
224
+ // The keycode for KeyCode::Key1 is 0
225
+ number : key_code as u8 + 1 ,
239
226
} ) ;
240
227
}
241
228
}
242
229
}
243
230
244
- // FIXME: make this work without duplication using `EventReader<T>` syntax and specialized behavior
245
- fn cycle_color ( mut query : Query < ( & mut Rainbow , & mut Events < CycleColorAction > ) > ) {
231
+ fn cycle_color ( mut query : Query < ( & mut ColorChoices , EventReader < CycleColorAction > ) > ) {
246
232
for ( mut color, action_queue) in query. iter_mut ( ) {
247
233
let mut reader = action_queue. get_reader ( ) ;
248
234
for _ in reader. iter ( & action_queue) {
You can’t perform that action at this time.
0 commit comments