Fixed bug 2766 - Haptic coding bugs and fixes for Linux FF: periodic.phase handled as time instead of angle; + direction clarification

Elias Vanderstuyft

It's not obvious from the general "haptic direction" description what the SDL direction actually means in terms of force magnitude sign,
currently its meaning is only reflected by the example.
This commit is contained in:
Sam Lantinga
2014-11-29 11:48:43 -08:00
parent 48481c8e55
commit ef8c3d89ce
2 changed files with 5 additions and 0 deletions

View File

@@ -669,6 +669,8 @@ SDL_SYS_ToDirection(Uint16 *dest, SDL_HapticDirection * src)
90 deg -> 0x4000 (left)
180 deg -> 0x8000 (up)
270 deg -> 0xC000 (right)
The force pulls into the direction specified by Linux directions,
i.e. the opposite convention of SDL directions.
*/
tmp = ((src->dir[0] % 36000) * 0x8000) / 18000; /* convert to range [0,0xFFFF] */
*dest = (Uint16) tmp;