comparison src/haptic/win32/SDL_syshaptic.c @ 2572:bb1481265341 gsoc2008_force_feedback

More windows haptic patches.
author Edgar Simo <bobbens@gmail.com>
date Thu, 31 Jul 2008 16:23:52 +0000
parents 6b29d9f267be
children 40b89e3d7ab5
comparison
equal deleted inserted replaced
2571:6b29d9f267be 2572:bb1481265341
188 188
189 /* 189 /*
190 * Callback to get all supported effects. 190 * Callback to get all supported effects.
191 */ 191 */
192 #define EFFECT_TEST(e,s) \ 192 #define EFFECT_TEST(e,s) \
193 if (pei->guid == (e)) \ 193 if (pei->guid == &(e)) \
194 haptic->supported |= (s) 194 haptic->supported |= (s)
195 static BOOL CALLBACK 195 static BOOL CALLBACK
196 DI_EffectCallback(LPCDIEFFECTINFO pei, LPVOID pv) 196 DI_EffectCallback(LPCDIEFFECTINFO pei, LPVOID pv)
197 { 197 {
198 /* Prepare the haptic device. */ 198 /* Prepare the haptic device. */
688 return -1; 688 return -1;
689 } 689 }
690 SDL_memset(condition, 0, sizeof(DICONDITION)); 690 SDL_memset(condition, 0, sizeof(DICONDITION));
691 691
692 /* Specifics */ 692 /* Specifics */
693 for (i=0; i<dest->cAxes; i++) { 693 for (i=0; i<(int)dest->cAxes; i++) {
694 condition[i].lOffset = CONVERT(hap_condition->center[i]); 694 condition[i].lOffset = CONVERT(hap_condition->center[i]);
695 condition[i].lPositiveCoefficient = CONVERT(hap_condition->right_coeff[i]); 695 condition[i].lPositiveCoefficient = CONVERT(hap_condition->right_coeff[i]);
696 condition[i].lNegativeCoefficient = CONVERT(hap_condition->left_coeff[i]); 696 condition[i].lNegativeCoefficient = CONVERT(hap_condition->left_coeff[i]);
697 condition[i].dwPositiveSaturation = CONVERT(hap_condition->right_sat[i]); 697 condition[i].dwPositiveSaturation = CONVERT(hap_condition->right_sat[i]);
698 condition[i].dwNegativeSaturation = CONVERT(hap_condition->left_sat[i]); 698 condition[i].dwNegativeSaturation = CONVERT(hap_condition->left_sat[i]);
855 REFGUID 855 REFGUID
856 SDL_SYS_HapticEffectType(struct haptic_effect * effect) 856 SDL_SYS_HapticEffectType(struct haptic_effect * effect)
857 { 857 {
858 switch (effect->effect.type) { 858 switch (effect->effect.type) {
859 case SDL_HAPTIC_CONSTANT: 859 case SDL_HAPTIC_CONSTANT:
860 return GUID_ConstantForce; 860 return &GUID_ConstantForce;
861 861
862 case SDL_HAPTIC_RAMP: 862 case SDL_HAPTIC_RAMP:
863 return GUID_RampForce; 863 return &GUID_RampForce;
864 864
865 case SDL_HAPTIC_SQUARE: 865 case SDL_HAPTIC_SQUARE:
866 return GUID_Square; 866 return &GUID_Square;
867 867
868 case SDL_HAPTIC_SINE: 868 case SDL_HAPTIC_SINE:
869 return GUID_Sine; 869 return &GUID_Sine;
870 870
871 case SDL_HAPTIC_TRIANGLE: 871 case SDL_HAPTIC_TRIANGLE:
872 return GUID_Triangle; 872 return &GUID_Triangle;
873 873
874 case SDL_HAPTIC_SAWTOOTHUP: 874 case SDL_HAPTIC_SAWTOOTHUP:
875 return GUID_SawtoothUp; 875 return &GUID_SawtoothUp;
876 876
877 case SDL_HAPTIC_SAWTOOTHDOWN: 877 case SDL_HAPTIC_SAWTOOTHDOWN:
878 return GUID_SawtoothDown; 878 return &GUID_SawtoothDown;
879 879
880 case SDL_HAPTIC_SPRING: 880 case SDL_HAPTIC_SPRING:
881 return GUID_Spring; 881 return &GUID_Spring;
882 882
883 case SDL_HAPTIC_DAMPER: 883 case SDL_HAPTIC_DAMPER:
884 return GUID_Damper; 884 return &GUID_Damper;
885 885
886 case SDL_HAPTIC_INERTIA: 886 case SDL_HAPTIC_INERTIA:
887 return GUID_Inertia; 887 return &GUID_Inertia;
888 888
889 case SDL_HAPTIC_FRICTION: 889 case SDL_HAPTIC_FRICTION:
890 return GUID_Friction; 890 return &GUID_Friction;
891 891
892 case SDL_HAPTIC_CUSTOM: 892 case SDL_HAPTIC_CUSTOM:
893 return GUID_CustomForce; 893 return &GUID_CustomForce;
894 894
895 default: 895 default:
896 SDL_SetError("Haptic: Unknown effect type."); 896 SDL_SetError("Haptic: Unknown effect type.");
897 return NULL; 897 return NULL;
898 } 898 }