Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Added SDL_HAPTIC_CUSTOM (not supported on linux).
Browse files Browse the repository at this point in the history
Exposed SDL_HapticEffectSupported().
  • Loading branch information
bobbens committed Jul 1, 2008
1 parent e54cc61 commit eeda569
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
22 changes: 17 additions & 5 deletions include/SDL_haptic.h
Expand Up @@ -53,15 +53,21 @@ typedef struct _SDL_Haptic SDL_Haptic;
#define SDL_HAPTIC_FRICTION (1<<4)
#define SDL_HAPTIC_DAMPER (1<<5)
#define SDL_HAPTIC_INERTIA (1<<6)
#define SDL_HAPTIC_GAIN (1<<7)
#define SDL_HAPTIC_AUTOCENTER (1<<8)
#define SDL_HAPTIC_CUSTOM (1<<7)
#define SDL_HAPTIC_GAIN (1<<8)
#define SDL_HAPTIC_AUTOCENTER (1<<9)


/*
* Different waveforms a SDL_HAPTIC_PERIODIC effect can have.
*/
typedef enum SDL_waveform {
SDL_WAVEFORM_SINE,
SDL_WAVEFORM_SQUARE,
SDL_WAVEFORM_TRIANGLE,
SDL_WAVEFORM_SAWTOOTHUP,
SDL_WAVEFORM_SAWTOOTHDOWN
SDL_WAVEFORM_SAWTOOTHDOWN,
SDL_WAVEFORM_CUSTOM
} SDL_waveform;


Expand Down Expand Up @@ -153,7 +159,6 @@ typedef struct SDL_HapticCondition {
Sint16 left_coeff; /* How fast to increase the force towards the left */
Uint16 deadband; /* Size of the dead zone */
Sint16 center; /* Position of the dead zone */

} SDL_HapticCondition;
typedef struct SDL_HapticRamp {
/* Header */
Expand All @@ -177,7 +182,6 @@ typedef struct SDL_HapticRamp {
Uint16 attack_level;
Uint16 fade_length;
Uint16 fade_level;

} SDL_HapticRamp;

typedef union SDL_HapticEffect {
Expand Down Expand Up @@ -230,6 +234,14 @@ extern DECLSPEC int SDL_HapticNumEffects(SDL_Haptic * haptic);
*/
extern DECLSPEC unsigned int SDL_HapticQueryEffects(SDL_Haptic * haptic);

/*
* Checks to see if effect is supported by haptic.
*
* Returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't and -1
* on error.
*/
extern DECLSPEC int SDL_HapticEffectSupported(SDL_Haptic * haptic, SDL_HapticEffect * effect);

/*
* Creates a new haptic effect on the device.
*
Expand Down
3 changes: 3 additions & 0 deletions src/haptic/SDL_haptic.c
Expand Up @@ -228,6 +228,9 @@ SDL_HapticQueryEffects(SDL_Haptic * haptic)
return haptic->supported;
}

/*
* Checks to see if the device can support the effect.
*/
int
SDL_HapticEffectSupported(SDL_Haptic * haptic, SDL_HapticEffect * effect)
{
Expand Down
1 change: 1 addition & 0 deletions src/haptic/linux/SDL_syshaptic.c
Expand Up @@ -94,6 +94,7 @@ EV_IsHaptic(int fd)
EV_TEST(FF_FRICTION, SDL_HAPTIC_FRICTION);
EV_TEST(FF_DAMPER, SDL_HAPTIC_DAMPER);
EV_TEST(FF_INERTIA, SDL_HAPTIC_INERTIA);
EV_TEST(FF_CUSTOM, SDL_HAPTIC_CUSTOM);
EV_TEST(FF_GAIN, SDL_HAPTIC_GAIN);
EV_TEST(FF_AUTOCENTER, SDL_HAPTIC_AUTOCENTER);

Expand Down

0 comments on commit eeda569

Please sign in to comment.