Hello,
I am having some problems to controle the force feedback of my wheel : logitech G29.
I have seen this tutorial :
" The basic usage is as follows:
Initialize the subsystem (SDL_INIT_HAPTIC)
Open a haptic device
SDL_HapticOpen() to open from index
SDL_HapticOpenFromJoystick() to open from an existing joystick
Create an effect (SDL_HapticEffect)
Upload the effect with SDL_HapticNewEffect()
Run the effect with SDL_HapticRunEffect()
(optional) Free the effect with SDL_HapticDestroyEffect()
Close the haptic device with SDL_HapticClose() "
I did the first step without any problem, the second step is also working but the following step is not working.
Here is my code :
printf(“Joystick haptic ? %d\n”,SDL_JoystickIsHaptic(volant)) ;
printf(“Number of haptic devices : %d\n”, SDL_NumHaptics()) ;
SDL_Init( SDL_INIT_HAPTIC ) ;
SDL_Haptic *haptic;
// Open the device
haptic = SDL_HapticOpen( 0 );
if (haptic == NULL)
printf("pas ouvert\n");
else
printf("Opened") ;
// Initialize simple rumble
if (SDL_HapticRumbleInit( haptic ) != 0)
{
printf("not initialised\n");
printf("Error : %s\n", SDL_GetError()) ;
printf("Effect supported ? : %d\n",SDL_HapticRumbleSupported( haptic )) ;
}
// Play effect at 50% strength for 2 seconds
if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0)
{
printf("not launched\n");
printf("Error : %s\n", SDL_GetError()) ;
}
SDL_Delay( 2000 );
// Clean up
SDL_HapticClose( haptic );
volant is the name of my joystick.
I am using Eclipse with MinGW on windows.
Here are the results of my code :
Thank you for your help.