Moving the Windows-specific includes into the Windows-specific header file
[freeglut] / src / Common / freeglut_internal.h
index f4fc756..d6d1743 100644 (file)
 \r
 /* -- PLATFORM-SPECIFIC INCLUDES ------------------------------------------- */\r
 \r
-/* All Win32 headers depend on the huge windows.h recursive include.\r
- * Note: Lower-case header names are used, for best cross-platform\r
- * compatibility.\r
- */\r
-#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)\r
-#    include <windows.h>\r
-#    include <windowsx.h>\r
-#    include <mmsystem.h>\r
-/* CYGWIN does not have tchar.h, but has TEXT(x), defined in winnt.h. */\r
-#    ifndef __CYGWIN__\r
-#      include <tchar.h>\r
-#    else\r
-#      define _TEXT(x) TEXT(x)\r
-#      define _T(x)    TEXT(x)\r
-#    endif\r
-\r
-#elif TARGET_HOST_POSIX_X11\r
+#if TARGET_HOST_POSIX_X11\r
 #    include <GL/glx.h>\r
 #    include <X11/Xlib.h>\r
 #    include <X11/Xatom.h>\r
@@ -779,6 +763,86 @@ struct tagSFG_StrokeFont
     const SFG_StrokeChar** Characters;          /* The characters mapping    */\r
 };\r
 \r
+\r
+/* -- JOYSTICK-SPECIFIC STRUCTURES AND TYPES ------------------------------- */\r
+/* XXX It might be better to poll the operating system for the numbers of buttons and\r
+ * XXX axes and then dynamically allocate the arrays.\r
+ */\r
+#define _JS_MAX_BUTTONS 32\r
+\r
+#if TARGET_HOST_MACINTOSH\r
+#    define _JS_MAX_AXES  9\r
+typedef struct tagSFG_PlatformJoystick SFG_PlatformJoystick;\r
+struct tagSFG_PlatformJoystick\r
+{\r
+#define  ISP_NUM_AXIS    9\r
+#define  ISP_NUM_NEEDS  41\r
+    ISpElementReference isp_elem  [ ISP_NUM_NEEDS ];\r
+    ISpNeed             isp_needs [ ISP_NUM_NEEDS ];\r
+};\r
+#endif\r
+\r
+#if TARGET_HOST_MAC_OSX\r
+#    define _JS_MAX_AXES 16\r
+typedef struct tagSFG_PlatformJoystick SFG_PlatformJoystick;\r
+struct tagSFG_PlatformJoystick\r
+{\r
+    IOHIDDeviceInterface ** hidDev;\r
+    IOHIDElementCookie buttonCookies[41];\r
+    IOHIDElementCookie axisCookies[_JS_MAX_AXES];\r
+/* The next two variables are not used anywhere */\r
+/*    long minReport[_JS_MAX_AXES],\r
+ *         maxReport[_JS_MAX_AXES];\r
+ */\r
+};\r
+#endif\r
+\r
+#if TARGET_HOST_POSIX_X11\r
+#    define _JS_MAX_AXES 16\r
+typedef struct tagSFG_PlatformJoystick SFG_PlatformJoystick;\r
+struct tagSFG_PlatformJoystick\r
+{\r
+#   if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)\r
+       struct os_specific_s *os;\r
+#   endif\r
+\r
+#   ifdef JS_NEW\r
+       struct js_event     js;\r
+       int          tmp_buttons;\r
+       float        tmp_axes [ _JS_MAX_AXES ];\r
+#   else\r
+       struct JS_DATA_TYPE js;\r
+#   endif\r
+\r
+    char         fname [ 128 ];\r
+    int          fd;\r
+};\r
+#endif\r
+\r
+/*\r
+ * Definition of "SFG_Joystick" structure -- based on JS's "jsJoystick" object class.\r
+ * See "js.h" lines 80-178.\r
+ */\r
+typedef struct tagSFG_Joystick SFG_Joystick;\r
+struct tagSFG_Joystick\r
+{\r
+       SFG_PlatformJoystick pJoystick;\r
+\r
+    int          id;\r
+    GLboolean    error;\r
+    char         name [ 128 ];\r
+    int          num_axes;\r
+    int          num_buttons;\r
+\r
+    float dead_band[ _JS_MAX_AXES ];\r
+    float saturate [ _JS_MAX_AXES ];\r
+    float center   [ _JS_MAX_AXES ];\r
+    float max      [ _JS_MAX_AXES ];\r
+    float min      [ _JS_MAX_AXES ];\r
+};\r
+\r
+\r
+\r
 /* -- GLOBAL VARIABLES EXPORTS --------------------------------------------- */\r
 \r
 /* Freeglut display related stuff (initialized once per session) */\r
@@ -991,10 +1055,6 @@ int fgHintPresent(Window window, Atom property, Atom hint);
 \r
 SFG_Proc fghGetProcAddress( const char *procName );\r
 \r
-#if TARGET_HOST_MS_WINDOWS\r
-extern void (__cdecl *__glutExitFunc)( int return_value );\r
-#endif\r
-\r
 #endif /* FREEGLUT_INTERNAL_H */\r
 \r
 /*** END OF FILE ***/\r