mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-23 13:09:11 +00:00
Pass the event timestamp for joystick events
This allows the application to get more fine grained information about controller event timing, and group events that happened together.
This commit is contained in:
parent
f32cdfa096
commit
73f4aeee6a
36 changed files with 950 additions and 839 deletions
|
@ -504,6 +504,7 @@ static void VIRTUAL_JoystickUpdate(SDL_Joystick *joystick)
|
|||
{
|
||||
joystick_hwdata *hwdata;
|
||||
int i;
|
||||
Uint64 timestamp = SDL_GetTicksNS();
|
||||
|
||||
if (joystick == NULL) {
|
||||
return;
|
||||
|
@ -519,13 +520,13 @@ static void VIRTUAL_JoystickUpdate(SDL_Joystick *joystick)
|
|||
}
|
||||
|
||||
for (i = 0; i < hwdata->desc.naxes; ++i) {
|
||||
SDL_PrivateJoystickAxis(joystick, i, hwdata->axes[i]);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, i, hwdata->axes[i]);
|
||||
}
|
||||
for (i = 0; i < hwdata->desc.nbuttons; ++i) {
|
||||
SDL_PrivateJoystickButton(joystick, i, hwdata->buttons[i]);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, i, hwdata->buttons[i]);
|
||||
}
|
||||
for (i = 0; i < hwdata->desc.nhats; ++i) {
|
||||
SDL_PrivateJoystickHat(joystick, i, hwdata->hats[i]);
|
||||
SDL_PrivateJoystickHat(timestamp, joystick, i, hwdata->hats[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue