Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Added SDL_HAPTIC_CUSTOM (not supported on linux).

Exposed SDL_HapticEffectSupported().
  • Loading branch information
bobbens committed Jul 1, 2008
1 parent e54cc61 commit eeda5697ce5f7e5d8101fc2c4e77f55e3c3e6b3c
Showing with 21 additions and 5 deletions.
  1. +17 −5 include/SDL_haptic.h
  2. +3 −0 src/haptic/SDL_haptic.c
  3. +1 −0 src/haptic/linux/SDL_syshaptic.c
@@ -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;


@@ -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 */
@@ -177,7 +182,6 @@ typedef struct SDL_HapticRamp {
Uint16 attack_level;
Uint16 fade_length;
Uint16 fade_level;

} SDL_HapticRamp;

typedef union SDL_HapticEffect {
@@ -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.
*
@@ -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)
{
@@ -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);

0 comments on commit eeda569

Please sign in to comment.