Skip to content

Commit

Permalink
Fixed bug 2766 - Haptic coding bugs and fixes for Linux FF: periodic.…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
slouken committed Nov 29, 2014
1 parent 48481c8 commit ef8c3d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/SDL_haptic.h
Expand Up @@ -347,6 +347,9 @@ typedef struct _SDL_Haptic SDL_Haptic;
/**
* \brief Structure that represents a haptic direction.
*
* This is the direction where the force comes from,
* instead of the direction in which the force is exerted.
*
* Directions can be specified by:
* - ::SDL_HAPTIC_POLAR : Specified by polar coordinates.
* - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
Expand Down
2 changes: 2 additions & 0 deletions src/haptic/linux/SDL_syshaptic.c
Expand Up @@ -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;
Expand Down

0 comments on commit ef8c3d8

Please sign in to comment.