Skip to content

Commit 4ebb33d

Browse files
committed
Add SDL_GameControllerGetSensorDataWithTimestamp function
1 parent 40389bb commit 4ebb33d

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

units/sdl2.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ interface
154154
{$I sdlguid.inc} // 2.24.0
155155
{$I sdljoystick.inc} // 2.24.0
156156
{$I sdlsensor.inc} // 2.26.0
157-
{$I sdlgamecontroller.inc} // 2.24.0
157+
{$I sdlgamecontroller.inc} // 2.26.0
158158
{$I sdlhaptic.inc} // 2.26.2
159159
{$I sdlhidapi.inc} // 2.0.18
160160
{$I sdltouch.inc} // 2.24.0

units/sdlgamecontroller.inc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,32 @@ function SDL_GameControllerGetSensorDataRate(gamecontroller: PSDL_GameController
514514
function SDL_GameControllerGetSensorData(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; data: pcfloat; num_values: cint): cint; cdecl;
515515
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSensorData' {$ENDIF} {$ENDIF};
516516

517+
{**
518+
* Get the current state of a game controller sensor with the timestamp of the
519+
* last update.
520+
*
521+
* The number of values and interpretation of the data is sensor dependent.
522+
* See SDL_sensor.h for the details for each type of sensor.
523+
*
524+
* \param gamecontroller The controller to query
525+
* \param type The type of sensor to query
526+
* \param timestamp A pointer filled with the timestamp in microseconds of the
527+
* current sensor reading if available, or 0 if not
528+
* \param data A pointer filled with the current sensor state
529+
* \param num_values The number of values to write to data
530+
* \return 0 or -1 if an error occurred.
531+
*
532+
* \since This function is available since SDL 2.26.0.
533+
*}
534+
function SDL_GameControllerGetSensorDataWithTimestamp(
535+
gamecontroller: PSDL_GameController;
536+
senstype: TSDL_SensorType;
537+
timestamp: pcuint64;
538+
data: pcfloat;
539+
num_values: cint
540+
): cint; cdecl;
541+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSensorDataWithTimestamp' {$ENDIF} {$ENDIF};
542+
517543
{**
518544
* Query whether a game controller has rumble support.
519545
*}

0 commit comments

Comments
 (0)