Fixed issue where the throttle and other axes on racing wheels don't start at zero and show up as immediate input when the wheel is turned for the first time. Wait until they are actually moved before generating input from them.

This commit is contained in:
Sam Lantinga 2016-12-22 17:33:45 -08:00
parent b2f6c4c1bd
commit ca019dada5
3 changed files with 35 additions and 35 deletions

View file

@ -29,14 +29,21 @@
#include "SDL_joystick_c.h"
/* The SDL joystick structure */
typedef struct _SDL_JoystickAxisInfo
{
Sint16 value; /* Current axis states */
Sint16 zero; /* Zero point on the axis (-32768 for triggers) */
Sint16 intial_value; /* The very first value we saw on this axis */
SDL_bool moved; /* Whether the axis has moved */
} SDL_JoystickAxisInfo;
struct _SDL_Joystick
{
SDL_JoystickID instance_id; /* Device instance, monotonically increasing from 0 */
char *name; /* Joystick name - system dependent */
int naxes; /* Number of axis controls on the joystick */
Sint16 *axes; /* Current axis states */
Sint16 *axes_zero; /* Zero point on the axis (-32768 for triggers) */
SDL_JoystickAxisInfo *axes;
int nhats; /* Number of hats on the joystick */
Uint8 *hats; /* Current hat states */