public FfbRegisterGenCB ( FfbCbFunc cb, object data ) : void | ||
cb | FfbCbFunc | |
data | object | |
return | void |
public void FfbRegisterGenCB(FfbCbFunc cb, object data)
{
// Free existing GCHandle (if exists)
if (hFfbUserData.IsAllocated && hFfbUserData.Target != null)
hFfbUserData.Free();
// Convert object to pointer
hFfbUserData = GCHandle.Alloc(data);
// Apply the user-defined CB function
UserFfbCB = new FfbCbFunc(cb);
wf = new WrapFfbCbFunc(WrapperFfbCB);
_FfbRegisterGenCB(wf, (IntPtr)hFfbUserData);
}
vJoy::FfbRegisterGenCB ( WrapFfbCbFunc cb, |
public FfbInterface(TesterForm dialog) { dlg = dialog; joystick = dialog.joystick; // FFB #if false #pragma warning disable 0618 if (!joystick.FfbStart(id)) throw new Exception(String.Format("Failed to start Forcefeedback on device {0}", id)); #pragma warning restore 0618 // Convert Form to pointer and pass it as user data to the callback function GCHandle h = GCHandle.Alloc(dialog); IntPtr parameter = (IntPtr)h; // joystick.FfbRegisterGenCB(OnEffect, parameter); joystick.FfbRegisterGenCB(OnEffectObj, dialog); #endif }