Skip to content

Commit

Permalink
Increase repeat rate for joystick key events
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-drexler committed Dec 25, 2023
1 parent f46cac3 commit c5130f9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Quake/in_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@ Adapted from DarkPlaces by lordhavoc
*/
static void IN_JoyKeyEvent(qboolean wasdown, qboolean isdown, int key, double *timer)
{
static const double repeatdelay = 0.5; // time (in seconds) between initial press and first repetition
static const double repeatrate = 32.0; // ticks per second

// we can't use `realtime` for key repeats because it is not monotomic
const double currenttime = Sys_DoubleTime();

Expand All @@ -519,7 +522,7 @@ static void IN_JoyKeyEvent(qboolean wasdown, qboolean isdown, int key, double *t
{
if (currenttime >= *timer)
{
*timer = currenttime + 0.1;
*timer = currenttime + 1.0 / repeatrate;
Key_Event(key, true);
}
}
Expand All @@ -533,7 +536,7 @@ static void IN_JoyKeyEvent(qboolean wasdown, qboolean isdown, int key, double *t
{
if (isdown)
{
*timer = currenttime + 0.5;
*timer = currenttime + repeatdelay;
Key_Event(key, true);
}
}
Expand Down

0 comments on commit c5130f9

Please sign in to comment.