Add a "repeated" field to event_t

This commit is contained in:
LJ Sonic 2021-08-14 20:33:20 +02:00
parent 8adf4b672a
commit 38e82e55fc
3 changed files with 4 additions and 2 deletions

View file

@ -36,6 +36,7 @@ typedef struct
INT32 data1; // keys / mouse/joystick buttons INT32 data1; // keys / mouse/joystick buttons
INT32 data2; // mouse/joystick x move INT32 data2; // mouse/joystick x move
INT32 data3; // mouse/joystick y move INT32 data3; // mouse/joystick y move
boolean repeated; // key repeat
} event_t; } event_t;
// //

View file

@ -1012,7 +1012,7 @@ void I_ShutdownJoystick(void)
void I_GetJoystickEvents(void) void I_GetJoystickEvents(void)
{ {
static event_t event = {0,0,0,0}; static event_t event = {0,0,0,0,false};
INT32 i = 0; INT32 i = 0;
UINT64 joyhats = 0; UINT64 joyhats = 0;
#if 0 #if 0
@ -1282,7 +1282,7 @@ void I_ShutdownJoystick2(void)
void I_GetJoystick2Events(void) void I_GetJoystick2Events(void)
{ {
static event_t event = {0,0,0,0}; static event_t event = {0,0,0,0,false};
INT32 i = 0; INT32 i = 0;
UINT64 joyhats = 0; UINT64 joyhats = 0;
#if 0 #if 0

View file

@ -664,6 +664,7 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type)
return; return;
} }
event.data1 = Impl_SDL_Scancode_To_Keycode(evt.keysym.scancode); event.data1 = Impl_SDL_Scancode_To_Keycode(evt.keysym.scancode);
event.repeated = (evt.repeat != 0);
if (event.data1) D_PostEvent(&event); if (event.data1) D_PostEvent(&event);
} }