Skip to content

Commit 590dee0

Browse files
Update SDL_haptic.inc to 3.4.4
1 parent e315476 commit 590dee0

2 files changed

Lines changed: 54 additions & 30 deletions

File tree

units/SDL3.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ interface
105105
{$I SDL_keyboard.inc} // 3.4.4
106106
{$I SDL_joystick.inc} // 3.4.4
107107
{$I SDL_gamepad.inc} // 3.4.4
108-
{$I SDL_haptic.inc} // 3.2.0
108+
{$I SDL_haptic.inc} // 3.4.4
109109
{$I SDL_touch.inc} // 3.4.4
110110
{$I SDL_pen.inc} // 3.2.20
111111
{$I SDL_camera.inc} // 3.4.4

units/SDL_haptic.inc

Lines changed: 53 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
*
5858
* SDL_Haptic *haptic;
5959
* SDL_HapticEffect effect;
60-
* int effect_id;
60+
* SDL_HapticEffectID effect_id;
6161
*
6262
* // Open the device
6363
* haptic = SDL_OpenHapticFromJoystick(joystick);
@@ -124,17 +124,33 @@ type
124124
PPSDL_Haptic = ^PSDL_Haptic;
125125
PSDL_Haptic = type Pointer;
126126

127+
{
128+
* Misc defines.
129+
}
130+
131+
{
132+
* Used to play a device an infinite number of times.
133+
*
134+
* \since This macro is available since SDL 3.2.0.
135+
*
136+
* \sa SDL_RunHapticEffect
137+
}
138+
const
139+
SDL_HAPTIC_INFINITY = 4294967295;
140+
127141
{*
128142
* \name Haptic features
129143
*
130144
* Different haptic features a device can have.
131145
}
132-
{ @ }
133146

134147
{*
135148
* \name Haptic effects
136149
}
137-
{ @ }
150+
type
151+
PPSDL_HapticEffectType = ^PSDL_HapticEffectType;
152+
PSDL_HapticEffectType = ^TSDL_HapticEffectType;
153+
TSDL_HapticEffectType = type cuint16;
138154

139155
{*
140156
* Constant effect supported.
@@ -355,6 +371,15 @@ const
355371
* \name Direction encodings
356372
}
357373

374+
{*
375+
* Type of coordinates used for haptic direction.
376+
}
377+
type
378+
PPSDL_HapticDirectionType = ^PSDL_HapticDirectionType;
379+
PSDL_HapticDirectionType = ^TSDL_HapticDirectionType;
380+
TSDL_HapticDirectionType = type cuint8;
381+
382+
const
358383
{*
359384
* Uses polar coordinates for the direction.
360385
*
@@ -398,18 +423,17 @@ const
398423

399424
{ Haptic features }
400425

401-
{
402-
* Misc defines.
403-
}
404-
405426
{*
406-
* Used to play a device an infinite number of times.
427+
* ID for haptic effects.
407428
*
408-
* \since This macro is available since SDL 3.2.0.
429+
* This is -1 if the ID is invalid.
409430
*
410-
* \sa SDL_RunHapticEffect
431+
* \sa SDL_CreateHapticEffect
411432
}
412-
SDL_HAPTIC_INFINITY = 4294967295;
433+
type
434+
PPSDL_HapticEffectID = ^PSDL_HapticEffectID;
435+
PSDL_HapticEffectID = ^TSDL_HapticEffectID;
436+
TSDL_HapticEffectID = cint;
413437

414438
{*
415439
* Structure that represents a haptic direction.
@@ -518,8 +542,8 @@ type
518542
PPSDL_HapticDirection = ^PSDL_HapticDirection;
519543
PSDL_HapticDirection = ^TSDL_HapticDirection;
520544
TSDL_HapticDirection = record
521-
type_: cuint8; {*< The type of encoding. }
522-
dir: array[0..2] of cint32; {*< The encoded direction. }
545+
type_: TSDL_HapticDirectionType; {*< The type of encoding. }
546+
dir: array[0..2] of cint32; {*< The encoded direction. }
523547
end;
524548

525549
{*
@@ -540,7 +564,7 @@ type
540564
PSDL_HapticConstant = ^TSDL_HapticConstant;
541565
TSDL_HapticConstant = record
542566
{ Header }
543-
type_: cuint16; {*< SDL_HAPTIC_CONSTANT }
567+
type_: TSDL_HapticEffectType; {*< SDL_HAPTIC_CONSTANT }
544568
direction: TSDL_HapticDirection; {*< Direction of the effect. }
545569

546570
{ Replay }
@@ -628,9 +652,9 @@ type
628652
PSDL_HapticPeriodic = ^TSDL_HapticPeriodic;
629653
TSDL_HapticPeriodic = record
630654
{ Header }
631-
type_: cuint16; {*< SDL_HAPTIC_SINE, SDL_HAPTIC_SQUARE
632-
SDL_HAPTIC_TRIANGLE, SDL_HAPTIC_SAWTOOTHUP or
633-
SDL_HAPTIC_SAWTOOTHDOWN }
655+
type_: TSDL_HapticEffectType; {*< SDL_HAPTIC_SINE, SDL_HAPTIC_SQUARE
656+
SDL_HAPTIC_TRIANGLE, SDL_HAPTIC_SAWTOOTHUP or
657+
SDL_HAPTIC_SAWTOOTHDOWN }
634658
direction: TSDL_HapticDirection; {*< Direction of the effect. }
635659

636660
{ Replay }
@@ -686,8 +710,8 @@ type
686710
PSDL_HapticCondition = ^TSDL_HapticCondition;
687711
TSDL_HapticCondition = record
688712
{ Header }
689-
type_: cuint16; {*< SDL_HAPTIC_SPRING, SDL_HAPTIC_DAMPER,
690-
SDL_HAPTIC_INERTIA or SDL_HAPTIC_FRICTION }
713+
type_: TSDL_HapticEffectType; {*< SDL_HAPTIC_SPRING, SDL_HAPTIC_DAMPER,
714+
SDL_HAPTIC_INERTIA or SDL_HAPTIC_FRICTION }
691715
direction: TSDL_HapticDirection; {*< Direction of the effect. }
692716

693717
{ Replay }
@@ -727,7 +751,7 @@ type
727751
PSDL_HapticRamp = ^TSDL_HapticRamp;
728752
TSDL_HapticRamp = record
729753
{ Header }
730-
type_: cuint16; {*< SDL_HAPTIC_RAMP }
754+
type_: TSDL_HapticEffectType; {*< SDL_HAPTIC_RAMP }
731755
direction: TSDL_HapticDirection; {*< Direction of the effect. }
732756

733757
{ Replay }
@@ -768,7 +792,7 @@ type
768792
PSDL_HapticLeftRight = ^TSDL_HapticLeftRight;
769793
TSDL_HapticLeftRight = record
770794
{ Header }
771-
type_: cuint16; {*< SDL_HAPTIC_LEFTRIGHT }
795+
type_: TSDL_HapticEffectType; {*< SDL_HAPTIC_LEFTRIGHT }
772796

773797
{ Replay }
774798
length: cuint32; {*< Duration of the effect in milliseconds. }
@@ -800,7 +824,7 @@ type
800824
PSDL_HapticCustom = ^TSDL_HapticCustom;
801825
TSDL_HapticCustom = record
802826
{ Header }
803-
type_: cuint16; {*< SDL_HAPTIC_CUSTOM }
827+
type_: TSDL_HapticEffectType; {*< SDL_HAPTIC_CUSTOM }
804828
direction: TSDL_HapticDirection; {*< Direction of the effect. }
805829

806830
{ Replay }
@@ -902,7 +926,7 @@ type
902926
TSDL_HapticEffect = record
903927
{ Common for all force feedback effects }
904928
case Integer of
905-
0: (type_: cuint16); {*< Effect type. }
929+
0: (type_: TSDL_HapticEffectType); {*< Effect type. }
906930
1: (constant: TSDL_HapticConstant); {*< Constant effect. }
907931
2: (periodic: TSDL_HapticPeriodic); {*< Periodic effect. }
908932
3: (condition: TSDL_HapticCondition); {*< Condition effect. }
@@ -1197,7 +1221,7 @@ function SDL_HapticEffectSupported(haptic: PSDL_Haptic; effect: PSDL_HapticEffec
11971221
* \sa SDL_RunHapticEffect
11981222
* \sa SDL_UpdateHapticEffect
11991223
}
1200-
function SDL_CreateHapticEffect(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl;
1224+
function SDL_CreateHapticEffect(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): TSDL_HapticEffectID; cdecl;
12011225
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateHapticEffect' {$ENDIF} {$ENDIF};
12021226

12031227
{*
@@ -1220,7 +1244,7 @@ function SDL_CreateHapticEffect(haptic: PSDL_Haptic; effect: PSDL_HapticEffect):
12201244
* \sa SDL_CreateHapticEffect
12211245
* \sa SDL_RunHapticEffect
12221246
}
1223-
function SDL_UpdateHapticEffect(haptic: PSDL_Haptic; effect: cint; data: PSDL_HapticEffect): Boolean; cdecl;
1247+
function SDL_UpdateHapticEffect(haptic: PSDL_Haptic; effect: TSDL_HapticEffectID; data: PSDL_HapticEffect): Boolean; cdecl;
12241248
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateHapticEffect' {$ENDIF} {$ENDIF};
12251249

12261250
{*
@@ -1245,7 +1269,7 @@ function SDL_UpdateHapticEffect(haptic: PSDL_Haptic; effect: cint; data: PSDL_Ha
12451269
* \sa SDL_StopHapticEffect
12461270
* \sa SDL_StopHapticEffects
12471271
}
1248-
function SDL_RunHapticEffect(haptic: PSDL_Haptic; effect: cint; iterations: cuint32): Boolean; cdecl;
1272+
function SDL_RunHapticEffect(haptic: PSDL_Haptic; effect: TSDL_HapticEffectID; iterations: cuint32): Boolean; cdecl;
12491273
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RunHapticEffect' {$ENDIF} {$ENDIF};
12501274

12511275
{*
@@ -1261,7 +1285,7 @@ function SDL_RunHapticEffect(haptic: PSDL_Haptic; effect: cint; iterations: cuin
12611285
* \sa SDL_RunHapticEffect
12621286
* \sa SDL_StopHapticEffects
12631287
}
1264-
function SDL_StopHapticEffect(haptic: PSDL_Haptic; effect: cint): Boolean; cdecl;
1288+
function SDL_StopHapticEffect(haptic: PSDL_Haptic; effect: TSDL_HapticEffectID): Boolean; cdecl;
12651289
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StopHapticEffect' {$ENDIF} {$ENDIF};
12661290

12671291
{*
@@ -1277,7 +1301,7 @@ function SDL_StopHapticEffect(haptic: PSDL_Haptic; effect: cint): Boolean; cdecl
12771301
*
12781302
* \sa SDL_CreateHapticEffect
12791303
}
1280-
procedure SDL_DestroyHapticEffect(haptic: PSDL_Haptic; effect: cint); cdecl;
1304+
procedure SDL_DestroyHapticEffect(haptic: PSDL_Haptic; effect: TSDL_HapticEffectID); cdecl;
12811305
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyHapticEffect' {$ENDIF} {$ENDIF};
12821306

12831307
{*
@@ -1294,7 +1318,7 @@ procedure SDL_DestroyHapticEffect(haptic: PSDL_Haptic; effect: cint); cdecl;
12941318
*
12951319
* \sa SDL_GetHapticFeatures
12961320
}
1297-
function SDL_GetHapticEffectStatus(haptic: PSDL_Haptic; effect: cint): Boolean; cdecl;
1321+
function SDL_GetHapticEffectStatus(haptic: PSDL_Haptic; effect: TSDL_HapticEffectID): Boolean; cdecl;
12981322
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetHapticEffectStatus' {$ENDIF} {$ENDIF};
12991323

13001324
{*

0 commit comments

Comments
 (0)