cleaning up mixed tabs and spaces
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1840 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
a2fef0a9bb
commit
b8a9827c5b
@ -286,7 +286,7 @@ GLint getAttribOrUniformLocation(const char* name, GLuint program, GLboolean isA
|
||||
fprintf(stderr, "Warning: Could not bind attrib %s\n", name);
|
||||
}
|
||||
|
||||
checkError ("getAttribOrUniformLocation");
|
||||
checkError ("getAttribOrUniformLocation");
|
||||
return attrib;
|
||||
}
|
||||
else
|
||||
@ -297,7 +297,7 @@ GLint getAttribOrUniformLocation(const char* name, GLuint program, GLboolean isA
|
||||
fprintf(stderr, "Warning: Could not bind uniform %s\n", name);
|
||||
}
|
||||
|
||||
checkError ("getAttribOrUniformLocation");
|
||||
checkError ("getAttribOrUniformLocation");
|
||||
return uniform;
|
||||
}
|
||||
}
|
||||
|
@ -39,11 +39,11 @@
|
||||
|
||||
/* What supports variadic macros based off Wikipedia article on it (GCC-like must support C99 or higher to use variadic macros) */
|
||||
#if (((defined(__GNUC__) && (__GNUC__ >= 3)) || \
|
||||
(defined(__clang__))) && \
|
||||
(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))) || \
|
||||
(defined(_MSC_VER) && (_MSC_VER >= 1400)) || \
|
||||
(defined(__BORLANDC__) && (__BORLANDC__ >= 0x570)) || \
|
||||
(defined(__SUNPRO_C) && (__SUNPRO_C >= 0x530))
|
||||
(defined(__clang__))) && \
|
||||
(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))) || \
|
||||
(defined(_MSC_VER) && (_MSC_VER >= 1400)) || \
|
||||
(defined(__BORLANDC__) && (__BORLANDC__ >= 0x570)) || \
|
||||
(defined(__SUNPRO_C) && (__SUNPRO_C >= 0x530))
|
||||
#define FG_COMPILER_SUPPORTS_VA_ARGS 1
|
||||
#else
|
||||
#define FG_COMPILER_SUPPORTS_VA_ARGS 0
|
||||
@ -261,8 +261,8 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \
|
||||
}
|
||||
|
||||
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,b) \
|
||||
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT_UCALL(a,b) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
||||
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT_UCALL(a,b) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
||||
|
||||
/*
|
||||
* Combine _glut and _cb macros:
|
||||
@ -276,20 +276,20 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \
|
||||
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,b)
|
||||
|
||||
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG0(a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
||||
|
||||
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG0_2NAME(a,b) \
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,b) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,b) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
||||
|
||||
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG1(a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG1(a,a) \
|
||||
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,a)
|
||||
|
||||
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG1(a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG1(a,a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG1(a,a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
||||
|
||||
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG2(a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,a) \
|
||||
@ -300,12 +300,12 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \
|
||||
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,b)
|
||||
|
||||
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG2(a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
||||
|
||||
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG2_2NAME(a,b) \
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,b) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,b) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
||||
|
||||
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG3(a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,a) \
|
||||
@ -316,12 +316,12 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \
|
||||
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,a)
|
||||
|
||||
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG3(a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
||||
|
||||
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG3_2NAME(a,b) \
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,b) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,b) \
|
||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
||||
|
||||
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG4(a) \
|
||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG4(a,a) \
|
||||
|
@ -42,10 +42,10 @@ void FGAPIENTRY glutPostRedisplay( void )
|
||||
{
|
||||
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPostRedisplay" );
|
||||
if ( ! fgStructure.CurrentWindow )
|
||||
{
|
||||
{
|
||||
fgError ( " ERROR: Function <%s> called"
|
||||
" with no current window defined.", "glutPostRedisplay" ) ;
|
||||
}
|
||||
}
|
||||
|
||||
fgStructure.CurrentWindow->State.WorkMask |= GLUT_DISPLAY_WORK;
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ void fgInitialiseInputDevices ( void )
|
||||
{
|
||||
const char *dial_device=NULL;
|
||||
dial_device = getenv ( "GLUT_DIALS_SERIAL" );
|
||||
fgPlatformRegisterDialDevice ( dial_device );
|
||||
fgPlatformRegisterDialDevice ( dial_device );
|
||||
|
||||
if ( !dial_device ) return;
|
||||
if ( !( dialbox_port = serial_open ( dial_device ) ) ) return;
|
||||
|
@ -392,7 +392,7 @@ struct tagSFG_State
|
||||
int NumActiveJoysticks; /* Number of active joysticks (callback defined and positive pollrate) -- if zero, don't poll joysticks */
|
||||
GLboolean InputDevsInitialised; /* Only initialize if application calls for them */
|
||||
|
||||
int MouseWheelTicks; /* Number of ticks the mouse wheel has turned */
|
||||
int MouseWheelTicks; /* Number of ticks the mouse wheel has turned */
|
||||
|
||||
int AuxiliaryBufferNumber;/* Number of auxiliary buffers */
|
||||
int SampleNumber; /* Number of samples per pixel */
|
||||
@ -417,7 +417,7 @@ struct tagSFG_State
|
||||
typedef struct tagSFG_Display SFG_Display;
|
||||
struct tagSFG_Display
|
||||
{
|
||||
SFG_PlatformDisplay pDisplay;
|
||||
SFG_PlatformDisplay pDisplay;
|
||||
|
||||
int ScreenWidth; /* The screen's width in pixels */
|
||||
int ScreenHeight; /* The screen's height in pixels */
|
||||
@ -447,7 +447,7 @@ struct tagSFG_Context
|
||||
SFG_WindowHandleType Handle; /* The window's handle */
|
||||
SFG_WindowContextType Context; /* The window's OpenGL/WGL context */
|
||||
|
||||
SFG_PlatformContext pContext; /* The window's FBConfig (X11) or device context (Windows) */
|
||||
SFG_PlatformContext pContext; /* The window's FBConfig (X11) or device context (Windows) */
|
||||
|
||||
int DoubleBuffered; /* Treat the window as double-buffered */
|
||||
|
||||
@ -536,7 +536,7 @@ struct tagSFG_WindowState /* as per notes above, sizes always refer to the cli
|
||||
int DesiredZOrder; /* desired window Z Order position */
|
||||
fgDesiredVisibility DesiredVisibility;/* desired visibility (hidden, iconic, shown/normal) */
|
||||
|
||||
SFG_PlatformWindowState pWState; /* Window width/height (X11) or rectangle/style (Windows) from before a resize, and other stuff only needed on specific platforms */
|
||||
SFG_PlatformWindowState pWState; /* Window width/height (X11) or rectangle/style (Windows) from before a resize, and other stuff only needed on specific platforms */
|
||||
|
||||
long JoystickPollRate; /* The joystick polling rate */
|
||||
fg_time_t JoystickLastPoll; /* When the last poll happened */
|
||||
@ -589,10 +589,10 @@ do \
|
||||
(((window).CallBacks[WCB_ ## cbname]) = (SFG_Proc)(func)); \
|
||||
(((window).CallbackDatas[WCB_ ## cbname]) = (udata)); \
|
||||
} \
|
||||
else if( FETCH_USER_DATA_WCB( window, cbname ) != udata ) \
|
||||
{ \
|
||||
(((window).CallbackDatas[WCB_ ## cbname]) = (udata)); \
|
||||
} \
|
||||
else if( FETCH_USER_DATA_WCB( window, cbname ) != udata ) \
|
||||
{ \
|
||||
(((window).CallbackDatas[WCB_ ## cbname]) = (udata)); \
|
||||
} \
|
||||
} while( 0 )
|
||||
|
||||
/*
|
||||
@ -670,7 +670,7 @@ do \
|
||||
FGCB ## cbname ## UC func = (FGCB ## cbname ## UC)(FETCH_WCB( window, cbname )); \
|
||||
FGCBUserData userData = FETCH_USER_DATA_WCB( window, cbname ); \
|
||||
fgSetWindow( &window ); \
|
||||
func EXPAND_WCB( cbname )(( arg_list, userData )); \
|
||||
func EXPAND_WCB( cbname )(( arg_list, userData )); \
|
||||
} \
|
||||
} while( 0 )
|
||||
|
||||
@ -945,7 +945,7 @@ struct tagSFG_PlatformJoystick
|
||||
typedef struct tagSFG_Joystick SFG_Joystick;
|
||||
struct tagSFG_Joystick
|
||||
{
|
||||
SFG_PlatformJoystick pJoystick;
|
||||
SFG_PlatformJoystick pJoystick;
|
||||
|
||||
int id;
|
||||
GLboolean error;
|
||||
|
@ -135,7 +135,7 @@ static void fghDeactivateSubMenu( SFG_MenuEntry *menuEntry )
|
||||
static GLvoid fghGetVMaxExtent( SFG_Window* window, int* x, int* y )
|
||||
{
|
||||
if( fgStructure.GameModeWindow )
|
||||
fgPlatformGetGameModeVMaxExtent ( window, x, y );
|
||||
fgPlatformGetGameModeVMaxExtent ( window, x, y );
|
||||
else
|
||||
{
|
||||
*x = fgDisplay.ScreenWidth;
|
||||
@ -784,10 +784,10 @@ int FGAPIENTRY glutCreateMenuUcall( FGCBMenuUC callback, FGCBUserData userData )
|
||||
{
|
||||
/* The menu object creation code resides in fg_structure.c */
|
||||
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateMenuUcall" );
|
||||
if (fgState.ActiveMenus)
|
||||
{
|
||||
fgError( "Menu manipulation not allowed while menus in use." );
|
||||
}
|
||||
if (fgState.ActiveMenus)
|
||||
{
|
||||
fgError( "Menu manipulation not allowed while menus in use." );
|
||||
}
|
||||
|
||||
return fgCreateMenu( callback, userData )->ID;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ void fgInitialiseSpaceball(void)
|
||||
|
||||
void fgSpaceballClose(void)
|
||||
{
|
||||
fgPlatformSpaceballClose();
|
||||
fgPlatformSpaceballClose();
|
||||
}
|
||||
|
||||
int fgHasSpaceball(void)
|
||||
@ -88,12 +88,12 @@ void fgSpaceballClose(void)
|
||||
|
||||
int fgHasSpaceball(void)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fgSpaceballNumButtons(void)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void fgSpaceballSetWindow(SFG_Window *window)
|
||||
|
@ -293,7 +293,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
|
||||
return fgState.KeyRepeat;
|
||||
|
||||
default:
|
||||
return fgPlatformGlutDeviceGet ( eWhat );
|
||||
return fgPlatformGlutDeviceGet ( eWhat );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
|
||||
fgError( "Out of memory. Could not create window." );
|
||||
}
|
||||
|
||||
fgPlatformCreateWindow ( window );
|
||||
fgPlatformCreateWindow ( window );
|
||||
|
||||
fghClearCallBacks( window );
|
||||
SET_WCB( *window, Reshape, fghDefaultReshape, NULL);
|
||||
@ -183,10 +183,10 @@ void fgAddToWindowDestroyList( SFG_Window* window )
|
||||
SET_WCB( *window, Destroy, destroy, destroyData );
|
||||
}
|
||||
|
||||
/*
|
||||
* Similarly, clear all work set for the window, none of this has to be executed anymore
|
||||
*/
|
||||
window->State.WorkMask = 0;
|
||||
/*
|
||||
* Similarly, clear all work set for the window, none of this has to be executed anymore
|
||||
*/
|
||||
window->State.WorkMask = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -102,15 +102,15 @@ void fgPlatformInitialize( const char* displayName )
|
||||
HDC context = CreateDC(fgDisplay.pDisplay.DisplayName,0,0,0);
|
||||
if( context )
|
||||
{
|
||||
fgDisplay.ScreenWidth = GetDeviceCaps( context, HORZRES );
|
||||
fgDisplay.ScreenHeight = GetDeviceCaps( context, VERTRES );
|
||||
fgDisplay.ScreenWidthMM = GetDeviceCaps( context, HORZSIZE );
|
||||
fgDisplay.ScreenHeightMM = GetDeviceCaps( context, VERTSIZE );
|
||||
DeleteDC(context);
|
||||
fgDisplay.ScreenWidth = GetDeviceCaps( context, HORZRES );
|
||||
fgDisplay.ScreenHeight = GetDeviceCaps( context, VERTRES );
|
||||
fgDisplay.ScreenWidthMM = GetDeviceCaps( context, HORZSIZE );
|
||||
fgDisplay.ScreenHeightMM = GetDeviceCaps( context, VERTSIZE );
|
||||
DeleteDC(context);
|
||||
}
|
||||
else
|
||||
fgWarning("fgPlatformInitialize: "
|
||||
"CreateDC failed, Screen size info may be incorrect\n"
|
||||
fgWarning("fgPlatformInitialize: "
|
||||
"CreateDC failed, Screen size info may be incorrect\n"
|
||||
"This is quite likely caused by a bad '-display' parameter");
|
||||
|
||||
}
|
||||
@ -142,7 +142,7 @@ void fgPlatformInitialize( const char* displayName )
|
||||
void fgPlatformDeinitialiseInputDevices ( void )
|
||||
{
|
||||
#if !defined(_WIN32_WCE)
|
||||
fghCloseInputDevices ();
|
||||
fghCloseInputDevices ();
|
||||
#endif /* !defined(_WIN32_WCE) */
|
||||
fgState.JoysticksInitialised = GL_FALSE;
|
||||
fgState.InputDevsInitialised = GL_FALSE;
|
||||
@ -162,7 +162,7 @@ void fgPlatformCloseDisplay ( void )
|
||||
|
||||
void fgPlatformDestroyContext ( SFG_PlatformDisplay pDisplay, SFG_WindowContextType MContext )
|
||||
{
|
||||
/* Do nothing -- this is required for X11 */
|
||||
/* Do nothing -- this is required for X11 */
|
||||
}
|
||||
|
||||
/* -- PLATFORM-SPECIFIC INTERFACE FUNCTION -------------------------------------------------- */
|
||||
|
@ -108,6 +108,6 @@ int FGAPIENTRY __glutCreateMenuWithExit( void(* callback)( int ), void (__cdecl
|
||||
|
||||
int FGAPIENTRY __glutCreateMenuUcallWithExit(void(*callback)(int, void*), void(__cdecl *exit_function)(int), void* user_data)
|
||||
{
|
||||
__glutExitFunc = exit_function;
|
||||
return glutCreateMenuUcall(callback, user_data);
|
||||
__glutExitFunc = exit_function;
|
||||
return glutCreateMenuUcall(callback, user_data);
|
||||
}
|
||||
|
@ -55,145 +55,145 @@ RAWINPUTDEVICE __fgSpaceball = { 0x01, 0x08, 0x00, 0x00 };
|
||||
|
||||
void fgPlatformInitializeSpaceball(void)
|
||||
{
|
||||
HWND hwnd;
|
||||
sball_initialized = 1;
|
||||
if (!fgStructure.CurrentWindow)
|
||||
{
|
||||
sball_initialized = 0;
|
||||
return;
|
||||
}
|
||||
hwnd = fgStructure.CurrentWindow->Window.Handle;
|
||||
HWND hwnd;
|
||||
sball_initialized = 1;
|
||||
if (!fgStructure.CurrentWindow)
|
||||
{
|
||||
sball_initialized = 0;
|
||||
return;
|
||||
}
|
||||
hwnd = fgStructure.CurrentWindow->Window.Handle;
|
||||
|
||||
{
|
||||
BOOL ok;
|
||||
UINT cbSize = sizeof(__fgSpaceball);
|
||||
__fgSpaceball.hwndTarget = hwnd;
|
||||
ok = RegisterRawInputDevices(&__fgSpaceball, 1, cbSize);
|
||||
{
|
||||
BOOL ok;
|
||||
UINT cbSize = sizeof(__fgSpaceball);
|
||||
__fgSpaceball.hwndTarget = hwnd;
|
||||
ok = RegisterRawInputDevices(&__fgSpaceball, 1, cbSize);
|
||||
|
||||
if (!ok){
|
||||
__fgSpaceball.hwndTarget = NULL;
|
||||
sball_initialized = 0;
|
||||
}
|
||||
}
|
||||
if (!ok){
|
||||
__fgSpaceball.hwndTarget = NULL;
|
||||
sball_initialized = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fgPlatformSpaceballClose(void)
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
int fgPlatformHasSpaceball(void)
|
||||
{
|
||||
return __fgSpaceball.hwndTarget ? 1 : 0;
|
||||
return __fgSpaceball.hwndTarget ? 1 : 0;
|
||||
}
|
||||
|
||||
int fgPlatformSpaceballNumButtons(void)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void fgPlatformSpaceballSetWindow(SFG_Window *window)
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
int fgIsSpaceballWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
#define LOGITECH_VENDOR_ID 0x46d
|
||||
HRAWINPUT hRawInput = (HRAWINPUT)lParam;
|
||||
UINT inputCode = (UINT)wParam;
|
||||
UINT size;
|
||||
BYTE *rawInputBuffer;
|
||||
PRAWINPUT pRawInput;
|
||||
UINT res;
|
||||
RID_DEVICE_INFO sRidDeviceInfo;
|
||||
#define LOGITECH_VENDOR_ID 0x46d
|
||||
HRAWINPUT hRawInput = (HRAWINPUT)lParam;
|
||||
UINT inputCode = (UINT)wParam;
|
||||
UINT size;
|
||||
BYTE *rawInputBuffer;
|
||||
PRAWINPUT pRawInput;
|
||||
UINT res;
|
||||
RID_DEVICE_INFO sRidDeviceInfo;
|
||||
|
||||
if (!sball_initialized)
|
||||
{
|
||||
fgPlatformInitializeSpaceball();
|
||||
if (!sball_initialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!sball_initialized)
|
||||
{
|
||||
fgPlatformInitializeSpaceball();
|
||||
if (!sball_initialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
res = GetRawInputData(hRawInput, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER));
|
||||
if (res == -1)
|
||||
return;
|
||||
res = GetRawInputData(hRawInput, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER));
|
||||
if (res == -1)
|
||||
return;
|
||||
|
||||
rawInputBuffer = malloc(size * sizeof *rawInputBuffer);
|
||||
pRawInput = (PRAWINPUT)rawInputBuffer;
|
||||
rawInputBuffer = malloc(size * sizeof *rawInputBuffer);
|
||||
pRawInput = (PRAWINPUT)rawInputBuffer;
|
||||
|
||||
res = GetRawInputData(hRawInput, RID_INPUT, pRawInput, &size, sizeof(RAWINPUTHEADER));
|
||||
if (res == -1)
|
||||
return;
|
||||
if (pRawInput->header.dwType != RIM_TYPEHID)
|
||||
return;
|
||||
res = GetRawInputData(hRawInput, RID_INPUT, pRawInput, &size, sizeof(RAWINPUTHEADER));
|
||||
if (res == -1)
|
||||
return;
|
||||
if (pRawInput->header.dwType != RIM_TYPEHID)
|
||||
return;
|
||||
|
||||
sRidDeviceInfo.cbSize = sizeof(RID_DEVICE_INFO);
|
||||
size = sizeof(RID_DEVICE_INFO);
|
||||
res = GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICEINFO, &sRidDeviceInfo, &size);
|
||||
if (res == -1)
|
||||
return;
|
||||
{
|
||||
SFG_Window* window = fgWindowByHandle(hwnd);
|
||||
if ((window == NULL))
|
||||
return;
|
||||
sRidDeviceInfo.cbSize = sizeof(RID_DEVICE_INFO);
|
||||
size = sizeof(RID_DEVICE_INFO);
|
||||
res = GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICEINFO, &sRidDeviceInfo, &size);
|
||||
if (res == -1)
|
||||
return;
|
||||
{
|
||||
SFG_Window* window = fgWindowByHandle(hwnd);
|
||||
if ((window == NULL))
|
||||
return;
|
||||
|
||||
if (sRidDeviceInfo.hid.dwVendorId == LOGITECH_VENDOR_ID)
|
||||
{
|
||||
// Motion data comes in two parts: motion type and
|
||||
// displacement/rotation along three axis.
|
||||
// Orientation is a right handed coordinate system with
|
||||
// X goes right, Y goes up and Z goes towards viewer, e.g.
|
||||
// the one used in OpenGL
|
||||
if (pRawInput->data.hid.bRawData[0] ==
|
||||
SPNAV_EVENT_MOTION_TRANSLATION)
|
||||
{ // Translation vector
|
||||
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
|
||||
short X = pnData[0];
|
||||
short Y = -pnData[2];
|
||||
short Z = pnData[1];
|
||||
INVOKE_WCB(*window, SpaceMotion, (X, Y, Z));
|
||||
}
|
||||
else if (pRawInput->data.hid.bRawData[0] ==
|
||||
SPNAV_EVENT_MOTION_ROTATION)
|
||||
{ // Axis aligned rotation vector
|
||||
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
|
||||
short rX = pnData[0];
|
||||
short rY = -pnData[2];
|
||||
short rZ = pnData[1];
|
||||
INVOKE_WCB(*window, SpaceRotation, (rX, rY, rZ));
|
||||
}
|
||||
else if (pRawInput->data.hid.bRawData[0] ==
|
||||
SPNAV_EVENT_BUTTON)
|
||||
{ // State of the keys
|
||||
unsigned long dwKeystate = *(unsigned long*)(&pRawInput->data.hid.bRawData[1]);
|
||||
unsigned int state = GLUT_UP;
|
||||
if (FETCH_WCB(*window, SpaceButton))
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
unsigned long stateBefore = __fgSpaceKeystate&(1 << i);
|
||||
unsigned long stateNow = dwKeystate&(1 << i);
|
||||
if (sRidDeviceInfo.hid.dwVendorId == LOGITECH_VENDOR_ID)
|
||||
{
|
||||
// Motion data comes in two parts: motion type and
|
||||
// displacement/rotation along three axis.
|
||||
// Orientation is a right handed coordinate system with
|
||||
// X goes right, Y goes up and Z goes towards viewer, e.g.
|
||||
// the one used in OpenGL
|
||||
if (pRawInput->data.hid.bRawData[0] ==
|
||||
SPNAV_EVENT_MOTION_TRANSLATION)
|
||||
{ // Translation vector
|
||||
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
|
||||
short X = pnData[0];
|
||||
short Y = -pnData[2];
|
||||
short Z = pnData[1];
|
||||
INVOKE_WCB(*window, SpaceMotion, (X, Y, Z));
|
||||
}
|
||||
else if (pRawInput->data.hid.bRawData[0] ==
|
||||
SPNAV_EVENT_MOTION_ROTATION)
|
||||
{ // Axis aligned rotation vector
|
||||
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
|
||||
short rX = pnData[0];
|
||||
short rY = -pnData[2];
|
||||
short rZ = pnData[1];
|
||||
INVOKE_WCB(*window, SpaceRotation, (rX, rY, rZ));
|
||||
}
|
||||
else if (pRawInput->data.hid.bRawData[0] ==
|
||||
SPNAV_EVENT_BUTTON)
|
||||
{ // State of the keys
|
||||
unsigned long dwKeystate = *(unsigned long*)(&pRawInput->data.hid.bRawData[1]);
|
||||
unsigned int state = GLUT_UP;
|
||||
if (FETCH_WCB(*window, SpaceButton))
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
unsigned long stateBefore = __fgSpaceKeystate&(1 << i);
|
||||
unsigned long stateNow = dwKeystate&(1 << i);
|
||||
|
||||
if (stateBefore && !stateNow)
|
||||
INVOKE_WCB(*window, SpaceButton, (stateBefore, GLUT_UP));
|
||||
if (!stateBefore && stateNow)
|
||||
INVOKE_WCB(*window, SpaceButton, (stateNow, GLUT_DOWN));
|
||||
if (stateBefore && !stateNow)
|
||||
INVOKE_WCB(*window, SpaceButton, (stateBefore, GLUT_UP));
|
||||
if (!stateBefore && stateNow)
|
||||
INVOKE_WCB(*window, SpaceButton, (stateNow, GLUT_DOWN));
|
||||
|
||||
}
|
||||
}
|
||||
__fgSpaceKeystate = dwKeystate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
__fgSpaceKeystate = dwKeystate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -289,7 +289,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -497,9 +497,9 @@ typedef struct
|
||||
} m_proc_t;
|
||||
|
||||
static BOOL CALLBACK m_proc(HMONITOR mon,
|
||||
HDC hdc,
|
||||
LPRECT rect,
|
||||
LPARAM data)
|
||||
HDC hdc,
|
||||
LPRECT rect,
|
||||
LPARAM data)
|
||||
{
|
||||
m_proc_t *dp=(m_proc_t *)data;
|
||||
MONITORINFOEX info;
|
||||
@ -728,8 +728,8 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
|
||||
/* Enable multitouch: additional flag TWF_FINETOUCH, TWF_WANTPALM */
|
||||
#ifdef WM_TOUCH
|
||||
if (fghRegisterTouchWindow == (pRegisterTouchWindow)0xDEADBEEF)
|
||||
fghRegisterTouchWindow = (pRegisterTouchWindow)GetProcAddress(GetModuleHandle("user32"),"RegisterTouchWindow");
|
||||
if (fghRegisterTouchWindow)
|
||||
fghRegisterTouchWindow = (pRegisterTouchWindow)GetProcAddress(GetModuleHandle("user32"),"RegisterTouchWindow");
|
||||
if (fghRegisterTouchWindow)
|
||||
fghRegisterTouchWindow( window->Window.Handle, TWF_FINETOUCH | TWF_WANTPALM );
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user