Applied a patch from "extraeme@netbsd.org" to add joystick support.

Untested, but it compiles for me.

Should also add Joystick support for older FreeBSD systems.  Also
untested.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@211 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
rkrolib 2003-10-01 16:30:25 +00:00
parent 7a6c02639a
commit 400a9b3d11

View File

@ -56,8 +56,12 @@
#else #else
# include <unistd.h> # include <unistd.h>
# include <fcntl.h> # include <fcntl.h>
# ifdef __FreeBSD__ # if defined(__FreeBSD__) || defined(__NetBSD__)
# if __FreeBSD_version >= 500000
# include <sys/joystick.h> # include <sys/joystick.h>
# else
# include <machine/joystick.h>
# endif
# define JS_DATA_TYPE joystick # define JS_DATA_TYPE joystick
# define JS_RETURN (sizeof(struct JS_DATA_TYPE)) # define JS_RETURN (sizeof(struct JS_DATA_TYPE))
# elif defined(__linux__) # elif defined(__linux__)
@ -253,7 +257,7 @@ static void fghJoystickRawRead ( SFG_Joystick* joy, int* buttons, float* axes )
} }
if( buttons ) if( buttons )
# ifdef __FreeBSD__ # if defined(__FreeBSD__) || defined(__NetBSD__)
*buttons = (joy->js.b1 ? 1 : 0) | (joy->js.b2 ? 2 : 0); *buttons = (joy->js.b1 ? 1 : 0) | (joy->js.b2 ? 2 : 0);
# else # else
*buttons = joy->js.buttons; *buttons = joy->js.buttons;