Moving the definition of the "fgJoystick" structure type to the header file so I can use it across source code files

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1019 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
fayjf 2012-01-29 03:51:12 +00:00
parent 0f68653742
commit 3f41b865c4
2 changed files with 84 additions and 68 deletions

View File

@ -779,6 +779,90 @@ struct tagSFG_StrokeFont
const SFG_StrokeChar** Characters; /* The characters mapping */ 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 --------------------------------------------- */ /* -- GLOBAL VARIABLES EXPORTS --------------------------------------------- */
/* Freeglut display related stuff (initialized once per session) */ /* Freeglut display related stuff (initialized once per session) */

View File

@ -42,25 +42,17 @@
* interspersed * 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 #if TARGET_HOST_MACINTOSH
# define _JS_MAX_AXES 9
# include <InputSprocket.h> # include <InputSprocket.h>
#endif #endif
#if TARGET_HOST_MAC_OSX #if TARGET_HOST_MAC_OSX
# define _JS_MAX_AXES 16
# include <mach/mach.h> # include <mach/mach.h>
# include <IOKit/IOkitLib.h> # include <IOKit/IOkitLib.h>
# include <IOKit/hid/IOHIDLib.h> # include <IOKit/hid/IOHIDLib.h>
#endif #endif
#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE) #if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
# define _JS_MAX_AXES 8
# include <windows.h> # include <windows.h>
# include <mmsystem.h> # include <mmsystem.h>
# include <regstr.h> # include <regstr.h>
@ -68,7 +60,6 @@
#endif #endif
#if TARGET_HOST_POSIX_X11 #if TARGET_HOST_POSIX_X11
# define _JS_MAX_AXES 16
# ifdef HAVE_SYS_IOCTL_H # ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h> # include <sys/ioctl.h>
# endif # endif
@ -375,65 +366,6 @@ static int fghJoystickInitializeHID(struct os_specific_s *os,
# endif # endif
#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 * Functions associated with the "jsJoystick" class in PLIB
*/ */