#endif
//Added by Jinrong Xie (stonexjr@gmail.com) 12/24/2014
//for SpaceNavigator support on Windows.
- /*
- case WM_ACTIVATEAPP:
- fgInitialiseSpaceball();
- break;
- */
case WM_INPUT:
- fgSpaceballHandleWinEvent(hWnd, wParam, lParam);
+ if (fgHasSpaceball())
+ {
+ fgSpaceballHandleWinEvent(hWnd, wParam, lParam);
+ }
break;
default:
/* Handle unhandled messages */
// 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)//0x01)
+ SPNAV_EVENT_MOTION_TRANSLATION)
{ // Translation vector
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
short X = pnData[0];
INVOKE_WCB(*window, SpaceMotion, (X, Y, Z));
}
else if (pRawInput->data.hid.bRawData[0] ==
- SPNAV_EVENT_MOTION_ROTATION)//0x02)
+ SPNAV_EVENT_MOTION_ROTATION)
{ // Axis aligned rotation vector
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
short rX = pnData[0];
INVOKE_WCB(*window, SpaceRotation, (rX, rY, rZ));
}
else if (pRawInput->data.hid.bRawData[0] ==
- SPNAV_EVENT_BUTTON)//0x03)
+ SPNAV_EVENT_BUTTON)
{ // State of the keys
unsigned long dwKeystate = *(unsigned long*)(&pRawInput->data.hid.bRawData[1]);
unsigned int state = GLUT_UP;