Haptic: Deal with negative periodic magnitudes (thanks, Elias!).

A negative periodic magnitude doesn't exist in Windows' and MacOS' FF APIs

The periodic magnitude parameter of the SDL Haptic API is based on the Linux
 FF API, so it means they are not directly compatible:
    'dwMagnitude' is a 'DWORD', which is unsigned.

Fixes Bugzilla #2701.
This commit is contained in:
Ryan C. Gordon 2014-09-17 14:49:36 -04:00
parent 266c0023da
commit 5f9ea7edeb
4 changed files with 11 additions and 6 deletions

View file

@ -122,7 +122,8 @@ main(int argc, char **argv)
SDL_Log(" effect %d: Sine Wave\n", nefx);
efx[nefx].type = SDL_HAPTIC_SINE;
efx[nefx].periodic.period = 1000;
efx[nefx].periodic.magnitude = 0x4000;
efx[nefx].periodic.magnitude = -0x2000; /* Negative magnitude and ... */
efx[nefx].periodic.phase = 18000; /* ... 180 degrees phase shift => cancel eachother */
efx[nefx].periodic.length = 5000;
efx[nefx].periodic.attack_length = 1000;
efx[nefx].periodic.fade_length = 1000;