From 0e06798db312141adf7aa0bb05be79c7456fd747 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Mon, 15 Feb 2016 02:32:05 -0700 Subject: [PATCH] adding joy key repeat func --- quakespasm/Quake/in_sdl.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/quakespasm/Quake/in_sdl.c b/quakespasm/Quake/in_sdl.c index 56308fe5..b83711a5 100644 --- a/quakespasm/Quake/in_sdl.c +++ b/quakespasm/Quake/in_sdl.c @@ -492,6 +492,35 @@ void IN_ControllerButton(SDL_JoystickID instanceid, SDL_GameControllerButton but Key_Event(key, down); } +// from lordhavoc +static void IN_KeyEventForButton(qboolean oldbutton, qboolean newbutton, int key, double *timer) +{ + if (oldbutton) + { + if (newbutton) + { + if (realtime >= *timer) + { + Key_Event(key, true); + *timer = realtime + 0.1; + } + } + else + { + Key_Event(key, false); + *timer = 0; + } + } + else + { + if (newbutton) + { + Key_Event(key, true); + *timer = realtime + 0.5; + } + } +} + void IN_ControllerAxis(SDL_JoystickID instanceid, SDL_GameControllerAxis axis, Sint16 value) { float axisValue = Sint16ToPlusMinusOne( value );