Satijas
Joined 14 September 2009
About Me
Hi, my name is Sasha. I'm in GAM670
Force Feedback
Add this to Configuration.h:
#define IDC_NOFF //number
In iInput.h, add line 1 in the iJoystick class In Input.h, add line 2 in the Joystick class In Input.h, add line 3 in the Joystick class
1. public: virtual void updateForce(float, double, int) = 0; 2. int feedBackOFF; LPDIRECTINPUTEFFECT centre; LPDIRECTINPUTEFFECT ffEffects;
3. public: void updateForce(float factor, double time, int direction);
In Input.cpp, add the following to the Joystick constructor
ffEffects = NULL; centre = NULL; feedBackOFF = 0;
add this in Joystick::interrogate function:
DIDEVCAPS didcaps; didcaps.dwSize = sizeof didcaps; if(SUCCEEDED(didInter->GetCapabilities(&didcaps)) && (didcaps.dwFlags && DIDC_FOREFEEDBACK){ EnableWindow(GetDlgItem((HWND)hwnd, IDC_NOFF), TRUE); } else{ EnableWindow(GetDlgItem((HWND)hwnd, IDC_NOFF), FALSE); }
add this in Joystick::setup function:
feedBackOFF = !!(flags & 8);
change the SetCooperativeLevel in setup to check for device exclusivity
else if (FAILED(joystick->SetCooperativeLevel((HWND)hwnd, (feedBackOFF ? DISCL_NONEXCLUSIVE : DISCL_EXCLUSIVE) | DISCL_FOREGROUND)))
add this line after (!zAxisOn)
if(feedBackOFF) centre = NULL;