https://gist.github.com/charlie-x/c4265 ... bec0b3d205
still have to work to do with it, but figured maybe its useful for others wanting to do the same as starting point
Like I added a feature where the left trigger can scale the feed rate. joyGetPosEx doesn't have features for the other sticks so it can't be a basic func replacement.
i wouldn't cut and paste this without some testing.
Code: Select all
// Triggers return 0 - 255
if (!FirstFeedRateLow && (state.Gamepad.bLeftTrigger) == 0)
{
SetDlgItemText(IDC_FeedRateEdit, OrigFeedRate);
PostMessage(WM_COMMAND, IDC_FeedRateApply);
FirstFeedRateLow = true;
}
else if (state.Gamepad.bLeftTrigger) {
if (FirstFeedRateLow) {
// remember what it was.
GetDlgItemText(IDC_FeedRateEdit, OrigFeedRate);
}
FirstFeedRateLow = false;
CString tRate;
//convert from 0 - 255 to 0 - 1.0f
float rate = (1.0f / 255.0f) * float(255 - state.Gamepad.bLeftTrigger);
// snapping back the trigger will miss the last conversion.
// slight dead zones
rate = max(0.1f, rate);
// when let it it'll reset to original feed rate anyway.
///if (rate > 0.94f) rate = 1.0f;
tRate.Format("%0.02f", rate);
SetDlgItemText(IDC_FeedRateEdit, tRate);
PostMessage(WM_COMMAND, IDC_FeedRateApply);
}