diff --git a/freeglut/freeglut/src/Common/freeglut_internal.h b/freeglut/freeglut/src/Common/freeglut_internal.h index e4b9d8f..1d0a5b6 100644 --- a/freeglut/freeglut/src/Common/freeglut_internal.h +++ b/freeglut/freeglut/src/Common/freeglut_internal.h @@ -779,6 +779,90 @@ struct tagSFG_StrokeFont const SFG_StrokeChar** Characters; /* The characters mapping */ }; + +/* -- JOYSTICK-SPECIFIC STRUCTURES AND TYPES ------------------------------- */ +/* XXX It might be better to poll the operating system for the numbers of buttons and + * XXX axes and then dynamically allocate the arrays. + */ +#define _JS_MAX_BUTTONS 32 + +#if TARGET_HOST_MACINTOSH +# define _JS_MAX_AXES 9 +#endif + +#if TARGET_HOST_MAC_OSX +# define _JS_MAX_AXES 16 +#endif + +#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE) +# define _JS_MAX_AXES 8 +#endif + +#if TARGET_HOST_POSIX_X11 +# define _JS_MAX_AXES 16 +#endif + +/* + * Definition of "SFG_Joystick" structure -- based on JS's "jsJoystick" object class. + * See "js.h" lines 80-178. + */ +typedef struct tagSFG_Joystick SFG_Joystick; +struct tagSFG_Joystick +{ +#if TARGET_HOST_MACINTOSH +#define ISP_NUM_AXIS 9 +#define ISP_NUM_NEEDS 41 + ISpElementReference isp_elem [ ISP_NUM_NEEDS ]; + ISpNeed isp_needs [ ISP_NUM_NEEDS ]; +#endif + +#if TARGET_HOST_MAC_OSX + IOHIDDeviceInterface ** hidDev; + IOHIDElementCookie buttonCookies[41]; + IOHIDElementCookie axisCookies[_JS_MAX_AXES]; + long minReport[_JS_MAX_AXES], + maxReport[_JS_MAX_AXES]; +#endif + +#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE) + JOYCAPS jsCaps; + JOYINFOEX js; + UINT js_id; +#endif + + +#if TARGET_HOST_POSIX_X11 +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) + struct os_specific_s *os; +# endif + +# ifdef JS_NEW + struct js_event js; + int tmp_buttons; + float tmp_axes [ _JS_MAX_AXES ]; +# else + struct JS_DATA_TYPE js; +# endif + + char fname [ 128 ]; + int fd; +#endif + + int id; + GLboolean error; + char name [ 128 ]; + int num_axes; + int num_buttons; + + float dead_band[ _JS_MAX_AXES ]; + float saturate [ _JS_MAX_AXES ]; + float center [ _JS_MAX_AXES ]; + float max [ _JS_MAX_AXES ]; + float min [ _JS_MAX_AXES ]; +}; + + + /* -- GLOBAL VARIABLES EXPORTS --------------------------------------------- */ /* Freeglut display related stuff (initialized once per session) */ diff --git a/freeglut/freeglut/src/Common/freeglut_joystick.c b/freeglut/freeglut/src/Common/freeglut_joystick.c index bf5bf95..c5e1b4a 100644 --- a/freeglut/freeglut/src/Common/freeglut_joystick.c +++ b/freeglut/freeglut/src/Common/freeglut_joystick.c @@ -42,25 +42,17 @@ * interspersed */ -/* XXX It might be better to poll the operating system for the numbers of buttons and - * XXX axes and then dynamically allocate the arrays. - */ -#define _JS_MAX_BUTTONS 32 - #if TARGET_HOST_MACINTOSH -# define _JS_MAX_AXES 9 # include #endif #if TARGET_HOST_MAC_OSX -# define _JS_MAX_AXES 16 # include # include # include #endif #if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE) -# define _JS_MAX_AXES 8 # include # include # include @@ -68,7 +60,6 @@ #endif #if TARGET_HOST_POSIX_X11 -# define _JS_MAX_AXES 16 # ifdef HAVE_SYS_IOCTL_H # include # endif @@ -375,65 +366,6 @@ static int fghJoystickInitializeHID(struct os_specific_s *os, # endif #endif -/* - * Definition of "SFG_Joystick" structure -- based on JS's "jsJoystick" object class. - * See "js.h" lines 80-178. - */ -typedef struct tagSFG_Joystick SFG_Joystick; -struct tagSFG_Joystick -{ -#if TARGET_HOST_MACINTOSH -#define ISP_NUM_AXIS 9 -#define ISP_NUM_NEEDS 41 - ISpElementReference isp_elem [ ISP_NUM_NEEDS ]; - ISpNeed isp_needs [ ISP_NUM_NEEDS ]; -#endif - -#if TARGET_HOST_MAC_OSX - IOHIDDeviceInterface ** hidDev; - IOHIDElementCookie buttonCookies[41]; - IOHIDElementCookie axisCookies[_JS_MAX_AXES]; - long minReport[_JS_MAX_AXES], - maxReport[_JS_MAX_AXES]; -#endif - -#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE) - JOYCAPS jsCaps; - JOYINFOEX js; - UINT js_id; -#endif - - -#if TARGET_HOST_POSIX_X11 -# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) - struct os_specific_s *os; -# endif - -# ifdef JS_NEW - struct js_event js; - int tmp_buttons; - float tmp_axes [ _JS_MAX_AXES ]; -# else - struct JS_DATA_TYPE js; -# endif - - char fname [ 128 ]; - int fd; -#endif - - int id; - GLboolean error; - char name [ 128 ]; - int num_axes; - int num_buttons; - - float dead_band[ _JS_MAX_AXES ]; - float saturate [ _JS_MAX_AXES ]; - float center [ _JS_MAX_AXES ]; - float max [ _JS_MAX_AXES ]; - float min [ _JS_MAX_AXES ]; -}; - /* * Functions associated with the "jsJoystick" class in PLIB */