1
edit
Changes
no edit summary
== Force Feedback ==
Add this to Configuration.h:
<big>
#define IDC_NOFF //number
</big>
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
<big>
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);
</big>
In Input.cpp, add the following to the Joystick constructor
<big>
ffEffects = NULL;
centre = NULL;
feedBackOFF = 0;
</big>
add this in Joystick::interrogate function:
<big>
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);
}
</big>
add this in Joystick::setup function:
<big>
feedBackOFF = !!(flags & 8);
</big>
change the SetCooperativeLevel in setup to check for device exclusivity
<big>
else if (FAILED(joystick->SetCooperativeLevel((HWND)hwnd,
(feedBackOFF ? DISCL_NONEXCLUSIVE : DISCL_EXCLUSIVE) | DISCL_FOREGROUND)))
</big>
add this line after (!zAxisOn)
<big>
if(feedBackOFF)
centre = NULL;
</big>
[[Category:force feedback]]