X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2FCommon%2Ffreeglut_internal.h;h=d6d1743dc5ba58a093a1c2ad6b038bd4f4e72501;hb=0533f65a199109084a2cfc04ccb1e1fbae700729;hp=7697094d75af646178816908941424fc391822d4;hpb=83a7f1444d1388983a7b756dde26b0cc74101b13;p=freeglut diff --git a/src/Common/freeglut_internal.h b/src/Common/freeglut_internal.h index 7697094..d6d1743 100644 --- a/src/Common/freeglut_internal.h +++ b/src/Common/freeglut_internal.h @@ -88,23 +88,7 @@ /* -- PLATFORM-SPECIFIC INCLUDES ------------------------------------------- */ -/* All Win32 headers depend on the huge windows.h recursive include. - * Note: Lower-case header names are used, for best cross-platform - * compatibility. - */ -#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE) -# include -# include -# include -/* CYGWIN does not have tchar.h, but has TEXT(x), defined in winnt.h. */ -# ifndef __CYGWIN__ -# include -# else -# define _TEXT(x) TEXT(x) -# define _T(x) TEXT(x) -# endif - -#elif TARGET_HOST_POSIX_X11 +#if TARGET_HOST_POSIX_X11 # include # include # include @@ -214,6 +198,7 @@ LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID); /* Platform-specific includes */ #if TARGET_HOST_POSIX_X11 + typedef struct tagSFG_PlatformDisplay SFG_PlatformDisplay; struct tagSFG_PlatformDisplay { @@ -247,6 +232,21 @@ struct tagSFG_PlatformDisplay int DisplayPointerY; /* saved Y location of the pointer */ }; + +/* + * Make "freeglut" window handle and context types so that we don't need so + * much conditionally-compiled code later in the library. + */ +typedef Window SFG_WindowHandleType ; +typedef GLXContext SFG_WindowContextType ; +typedef struct tagSFG_PlatformContext SFG_PlatformContext; +struct tagSFG_PlatformContext +{ + GLXFBConfig* FBConfig; /* The window's FBConfig */ +}; + + + #endif #if TARGET_HOST_MS_WINDOWS #include "../mswin/freeglut_internal_mswin.h" @@ -419,22 +419,6 @@ struct tagSFG_Timer }; /* - * Make "freeglut" window handle and context types so that we don't need so - * much conditionally-compiled code later in the library. - */ -#if TARGET_HOST_POSIX_X11 - -typedef Window SFG_WindowHandleType ; -typedef GLXContext SFG_WindowContextType ; - -#elif TARGET_HOST_MS_WINDOWS - -typedef HWND SFG_WindowHandleType ; -typedef HGLRC SFG_WindowContextType ; - -#endif - -/* * A window and its OpenGL context. The contents of this structure * are highly dependant on the target operating system we aim at... */ @@ -444,11 +428,7 @@ struct tagSFG_Context SFG_WindowHandleType Handle; /* The window's handle */ SFG_WindowContextType Context; /* The window's OpenGL/WGL context */ -#if TARGET_HOST_POSIX_X11 - GLXFBConfig* FBConfig; /* The window's FBConfig */ -#elif TARGET_HOST_MS_WINDOWS - HDC Device; /* The window's device context */ -#endif + SFG_PlatformContext pContext; /* The window's FBConfig (X11) or device context (Windows) */ int DoubleBuffered; /* Treat the window as double-buffered */ }; @@ -783,6 +763,86 @@ 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 +typedef struct tagSFG_PlatformJoystick SFG_PlatformJoystick; +struct tagSFG_PlatformJoystick +{ +#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 +# define _JS_MAX_AXES 16 +typedef struct tagSFG_PlatformJoystick SFG_PlatformJoystick; +struct tagSFG_PlatformJoystick +{ + IOHIDDeviceInterface ** hidDev; + IOHIDElementCookie buttonCookies[41]; + IOHIDElementCookie axisCookies[_JS_MAX_AXES]; +/* The next two variables are not used anywhere */ +/* long minReport[_JS_MAX_AXES], + * maxReport[_JS_MAX_AXES]; + */ +}; +#endif + +#if TARGET_HOST_POSIX_X11 +# define _JS_MAX_AXES 16 +typedef struct tagSFG_PlatformJoystick SFG_PlatformJoystick; +struct tagSFG_PlatformJoystick +{ +# 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 + +/* + * 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 +{ + SFG_PlatformJoystick pJoystick; + + 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) */ @@ -995,10 +1055,6 @@ int fgHintPresent(Window window, Atom property, Atom hint); SFG_Proc fghGetProcAddress( const char *procName ); -#if TARGET_HOST_MS_WINDOWS -extern void (__cdecl *__glutExitFunc)( int return_value ); -#endif - #endif /* FREEGLUT_INTERNAL_H */ /*** END OF FILE ***/