void SmoothJoystick::updateSJ() {
    for (unsigned int f = 0; f < NUMBUTTONS; f++){
        for (unsigned int s = 1; s < WAIT_TIME; s++){
            buttons[f][s - 1] = buttons [f][s];
        }
        buttons[f][WAIT_TIME - 1] = Joystick::GetRawButton(f+1);
    } 
    for (unsigned int x = 0; x < btnNumbers.size(); x++) {
        if(GetRawButton(btnNumbers.at(x)) && !prevState.at(x)) {
            callFunct(x);
            prevState.at(x) = true;
        } else if (!GetRawButton(btnNumbers.at(x))) {
            prevState.at(x) = false;
        }
    }
}
Exemplo n.º 2
0
void EnhancedJoystick::updateEJ() {
    for (unsigned int f = 0; f < NUMBUTTONS; f++){
        for (unsigned int s = 1; s < WAIT_TIME; s++){
            buttons[f][s - 1] = buttons [f][s];
        }
        buttons[f][WAIT_TIME - 1] = Joystick::GetRawButton(f+1);
    }
    for(unsigned int x = 0; x < btnNumbers.size(); x++)
    {
        if(GetRawButton(btnNumbers.at(x)) && previousState.at(x) == false)
        {
            callFunct(x);
            previousState.at(x) = true;
        }
        else if(GetRawButton(btnNumbers.at(x)) == false)
            previousState.at(x) = false;
    }
}