Improved scroll delay handling

This commit is contained in:
d0k3 2016-05-30 03:03:40 +02:00
parent b572dac3be
commit a40e617274

View File

@ -2,15 +2,20 @@
#include "timer.h" #include "timer.h"
u32 InputWait() { u32 InputWait() {
static u64 delay = 0;
u32 pad_state_old = HID_STATE; u32 pad_state_old = HID_STATE;
delay = (delay) ? 80 : 400;
timer_start(); timer_start();
while (true) { while (true) {
u32 pad_state = HID_STATE; u32 pad_state = HID_STATE;
if (!(~pad_state & BUTTON_ANY)) { // no buttons pressed if (!(~pad_state & BUTTON_ANY)) { // no buttons pressed
pad_state_old = pad_state; pad_state_old = pad_state;
delay = 0;
continue; continue;
} }
if ((pad_state == pad_state_old) && (!(pad_state & BUTTON_ARROW) || timer_msec() < 120)) if ((pad_state == pad_state_old) &&
(!(~pad_state & BUTTON_ARROW) ||
(delay && (timer_msec() < delay))))
continue; continue;
//Make sure the key is pressed //Make sure the key is pressed
u32 t_pressed = 0; u32 t_pressed = 0;