src/haptic/win32/SDL_syshaptic.c
branchgsoc2008_force_feedback
changeset 2571 6b29d9f267be
parent 2570 53bb7d21928d
child 2572 bb1481265341
equal deleted inserted replaced
2570:53bb7d21928d 2571:6b29d9f267be
   187 
   187 
   188 
   188 
   189 /*
   189 /*
   190  * Callback to get all supported effects.
   190  * Callback to get all supported effects.
   191  */
   191  */
   192 /*
       
   193 #define EFFECT_TEST(e,s)   \
   192 #define EFFECT_TEST(e,s)   \
   194 if (pei->guid == (e))      \
   193 if (pei->guid == (e))      \
   195    haptic->supported |= (s)
   194    haptic->supported |= (s)
   196 */
       
   197 static BOOL CALLBACK
   195 static BOOL CALLBACK
   198 DI_EffectCallback(LPCDIEffectInfo pei, LPVOID pv)
   196 DI_EffectCallback(LPCDIEFFECTINFO pei, LPVOID pv)
   199 {
   197 {
   200    /* Prepare the haptic device. */
   198    /* Prepare the haptic device. */
   201    SDL_Haptic *haptic = (SDL_Haptic*) pv;
   199    SDL_Haptic *haptic = (SDL_Haptic*) pv;
   202    haptic->supported = 0;
   200    haptic->supported = 0;
   203 
   201 
   204    /* Get supported. */
   202    /* Get supported. */
   205    switch (pei->guid) {
       
   206       case GUID_Spring:
       
   207          haptic->supported |= SDL_HAPTIC_SPRING;
       
   208          break;
       
   209       case GUID_Damper:
       
   210          haptic->supported |= SDL_HAPTIC_DAMPER;
       
   211          break;
       
   212       case GUID_Inertia:
       
   213          haptic->supported |= SDL_HAPTIC_INERTIA;
       
   214          break;
       
   215       case GUID_Friction:
       
   216          haptic->supported |= SDL_HAPTIC_FRICTION;
       
   217          break;
       
   218       case GUID_ConstantForce:
       
   219          haptic->supported |= SDL_HAPTIC_CONSTANT;
       
   220          break;
       
   221       case GUID_CustomForce:
       
   222          haptic->supported |= SDL_HAPTIC_CUSTOM;
       
   223          break;
       
   224       case GUID_Sine:
       
   225          haptic->supported |= SDL_HAPTIC_SINE;
       
   226          break;
       
   227       case GUID_Square:
       
   228          haptic->supported |= SDL_HAPTIC_SQUARE;
       
   229          break;
       
   230       case GUID_Triangle:
       
   231          haptic->supported |= SDL_HAPTIC_TRIANGLE;
       
   232          break;
       
   233       case GUID_SawtoothUp:
       
   234          haptic->supported |= SDL_HAPTIC_SAWTOOTHUP;
       
   235          break;
       
   236       case GUID_SawtoothDown:
       
   237          haptic->supported |= SDL_HAPTIC_SAWTOOTHDOWN;
       
   238          break;
       
   239       case GUID_RampForce:
       
   240          haptic->supported |= SDL_HAPTIC_RAMP;
       
   241          break;
       
   242 
       
   243       default:
       
   244          break;
       
   245    }
       
   246 /*
       
   247    EFFECT_TEST(GUID_Spring,         SDL_HAPTIC_SPRING);
   203    EFFECT_TEST(GUID_Spring,         SDL_HAPTIC_SPRING);
   248    EFFECT_TEST(GUID_Damper,         SDL_HAPTIC_DAMPER);
   204    EFFECT_TEST(GUID_Damper,         SDL_HAPTIC_DAMPER);
   249    EFFECT_TEST(GUID_Inertia,        SDL_HAPTIC_INERTIA);
   205    EFFECT_TEST(GUID_Inertia,        SDL_HAPTIC_INERTIA);
   250    EFFECT_TEST(GUID_Friction,       SDL_HAPTIC_FRICTION);
   206    EFFECT_TEST(GUID_Friction,       SDL_HAPTIC_FRICTION);
   251    EFFECT_TEST(GUID_ConstantForce,  SDL_HAPTIC_CONSTANT);
   207    EFFECT_TEST(GUID_ConstantForce,  SDL_HAPTIC_CONSTANT);
   254    EFFECT_TEST(GUID_Square,         SDL_HAPTIC_SQUARE);
   210    EFFECT_TEST(GUID_Square,         SDL_HAPTIC_SQUARE);
   255    EFFECT_TEST(GUID_Triangle,       SDL_HAPTIC_TRIANGLE);
   211    EFFECT_TEST(GUID_Triangle,       SDL_HAPTIC_TRIANGLE);
   256    EFFECT_TEST(GUID_SawtoothUp,     SDL_HAPTIC_SAWTOOTHUP);
   212    EFFECT_TEST(GUID_SawtoothUp,     SDL_HAPTIC_SAWTOOTHUP);
   257    EFFECT_TEST(GUID_SawtoothDown,   SDL_HAPTIC_SAWTOOTHDOWN);
   213    EFFECT_TEST(GUID_SawtoothDown,   SDL_HAPTIC_SAWTOOTHDOWN);
   258    EFFECT_TEST(GUID_RampForce,      SDL_HAPTIC_RAMP);
   214    EFFECT_TEST(GUID_RampForce,      SDL_HAPTIC_RAMP);
   259 */
       
   260   
   215   
   261    /* Check for more. */
   216    /* Check for more. */
   262    return DIENUM_CONTINUE;
   217    return DIENUM_CONTINUE;
   263 }
   218 }
   264 
   219