Skip to content

Commit

Permalink
feat: delete keyboard input
Browse files Browse the repository at this point in the history
changed
  • Loading branch information
boulce committed Jun 3, 2024
1 parent fcdd5bb commit e6cd6cb
Showing 1 changed file with 1 addition and 35 deletions.
36 changes: 1 addition & 35 deletions game/src/game/select_song.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub(crate) fn select_song(
let mut hit_right = false;
let mut last_left_hit_time = Instant::now();
let mut last_right_hit_time = Instant::now();
let hit_both_side_time_delay = 5; // ms
let hit_both_side_time_delay = 100; // ms

// font information
let font_path = &(FONT_PATH.to_owned() + "/sans.ttf");
Expand Down Expand Up @@ -129,40 +129,6 @@ pub(crate) fn select_song(
if event_loop_common(&event, &mut common_context.coins) {
break 'running;
}

match event {
Event::KeyDown {
// if user press right key, then song menu moves to left for specific distance
keycode: Some(Keycode::L),
repeat: false,
..
} => {
// to prevent changing direction when moving
if moving_direction == MovingDirection::Stop {
// If hitting left side, don't react directly. Just assign false to hit_left
if hit_left == false {
hit_left = true;
last_left_hit_time = Instant::now();
}
}
}
Event::KeyDown {
// if user press right key, then song menu moves to right for specific distance
keycode: Some(Keycode::K),
repeat: false,
..
} => {
// to prevent changing direction when moving
if moving_direction == MovingDirection::Stop {
// If hitting right side, don't react directly. Just assign false to hit_right
if hit_right == false {
hit_right = true;
last_right_hit_time = Instant::now();
}
}
}
_ => {}
}
}

// process janggu input
Expand Down

0 comments on commit e6cd6cb

Please sign in to comment.