view src/joystick/SDL_joystick_c.h @ 461:1d36f593078a

Date: Thu, 18 Jul 2002 23:51:40 +0200 (MEST) From: Krister Walfridsson Subject: [SDL] src/joystick/bsd/SDL_sysjoystick.c patch The *BSD USB HID joystick code has two serious bugs: 1. If a joystick reports unhandled hid_input usage (for example HUG_RZ or HUG_DIAL), then the last handled value will be overwritten with an arbitrary value. (Fixed in the patch below by adding a default case.) 2. The current code does only handle logical coordinates in the range 0-255, while a big part of available joysticks report -128 - 127. (This is solved in the patch below by first center the range around 0, and then stretch it to the correct range.)
author Sam Lantinga <slouken@libsdl.org>
date Tue, 20 Aug 2002 06:08:42 +0000
parents f6ffac90895c
children b8d311d90021
line wrap: on
line source

/*
    SDL - Simple DirectMedia Layer
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    Sam Lantinga
    slouken@libsdl.org
*/

#ifdef SAVE_RCSID
static char rcsid =
 "@(#) $Id$";
#endif

/* Useful functions and variables from SDL_joystick.c */
#include "SDL_joystick.h"

/* The number of available joysticks on the system */
extern Uint8 SDL_numjoysticks;

/* Internal event queueing functions */
extern int SDL_PrivateJoystickAxis(SDL_Joystick *joystick,
                                   Uint8 axis, Sint16 value);
extern int SDL_PrivateJoystickBall(SDL_Joystick *joystick,
                                   Uint8 ball, Sint16 xrel, Sint16 yrel);
extern int SDL_PrivateJoystickHat(SDL_Joystick *joystick,
                                 Uint8 hat, Uint8 value);
extern int SDL_PrivateJoystickButton(SDL_Joystick *joystick,
                                     Uint8 button, Uint8 state);