/** * Simple Button Access */ bool HotJoystick::Button(kButton btn) { switch (btn) { case kButtonA: return GetRawButton(1); case kButtonB: return GetRawButton(2); case kButtonX: return GetRawButton(3); case kButtonY: return GetRawButton(4); case kButtonLB: return GetRawButton(5); case kButtonRB: return GetRawButton(6); case kButtonStart: return GetRawButton(8); case kButtonBack: return GetRawButton(7); case kButtonLT: return GetRawAxis(2) > 0.4; case kButtonRT: return GetRawAxis(3) > 0.4; default: return false; } }
XBOX_ButtonState XBOX360_Controller::Get_ButtonState() { XBOX_ButtonState retval; retval.A = GetRawButton(XBOX360_A); retval.B = GetRawButton(XBOX360_B); retval.X = GetRawButton(XBOX360_X); retval.Y = GetRawButton(XBOX360_Y); retval.LeftBumper = GetRawButton(XBOX360_LEFT_BUMPER); retval.RightBumper = GetRawButton(XBOX360_RIGHT_BUMPER); retval.Back = GetRawButton(XBOX360_BACK); retval.Start = GetRawButton(XBOX360_START); retval.LeftStick = GetRawButton(XBOX360_LEFT_STICK); retval.RightStick = GetRawButton(XBOX360_RIGHT_STICK); return retval; }
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; } } }
void AdvancedJoystick::trackPresses () { for (unsigned int x = 0; x < f_pressedButtons.size(); x++) { if (!GetRawButton(f_pressedButtons[x])) f_pressedButtons.erase(f_pressedButtons.begin()+x); } }
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; } }
void SmoothJoystick::buttonUpdate() { for(int k = 0; k < NUMBUTTONS; k++) { std::bitset<3>* btnSet = buttons.at(k); btnSet->at(2) = btnSet->at(1); btnSet->at(1) = btnSet->at(0); btnSet->at(0) = GetRawButton(k); } }
void AdvancedJoystick::trackPresses () { std::vector<button_t>::iterator it; for (it = f_pressedButtons.begin(); it != f_pressedButtons.end(); ++it) { if (!GetRawButton(*it)) f_pressedButtons.erase(it); } }
bool AdvancedJoystick::GetButtonPress (button_t channel) { update(); if (GetRawButton(channel) && (m_timer->Get() == 0.0)) { m_timer->Start(); return true; } else return false; }
/** * Read the state of the top button on the joystick. * * Look up which button has been assigned to the top and read its state. * * @param hand This parameter is ignored for the Joystick class and is only here to complete the GenericHID interface. * @return The state of the top button. */ bool Joystick::GetTop(JoystickHand hand) { return GetRawButton(m_buttons[kTopButton]); }
/** * Read the state of the trigger on the joystick. * * Look up which button has been assigned to the trigger and read its state. * * @param hand This parameter is ignored for the Joystick class and is only here to complete the GenericHID interface. * @return The state of the trigger. */ bool Joystick::GetTrigger(JoystickHand hand) { return GetRawButton(m_buttons[kTriggerButton]); }
/** * Get the button value for the button set as the default top * * @param hand Unused * @return The state of the button. */ bool KinectStick::GetTop(JoystickHand hand) { return GetRawButton(kTopMask); }
bool SaitekX52Throttle::GetResetButton() { return GetRawButton(GetResetButtonNumber()); }
bool SaitekX52Throttle::GetStartStopButton() {return GetRawButton(GetStartStopButtonNumber());}
bool SaitekX52Throttle::GetFunctionButton() { return GetRawButton(GetFunctionButtonNumber()); }
/** * Get the state of a button on the F310. * * @param button The button to read from. * @return The state of the specified button. */ bool F310::GetButton(ButtonType button) { switch(button) { case kXButton: return GetRawButton(kXButtonNum); case kAButton: return GetRawButton(kAButtonNum); case kBButton: return GetRawButton(kBButtonNum); case kYButton: return GetRawButton(kYButtonNum); case kLeftBumper: return GetRawButton(kLeftBumperNum); case kRightBumper: return GetRawButton(kRightBumperNum); case kLeftTrigger: return GetRawButton(kLeftTriggerNum); case kRightTrigger: return GetRawButton(kRightTriggerNum); case kBackButton: return GetRawButton(kBackButtonNum); case kStartButton: return GetRawButton(kStartButtonNum); case kLeftStickButton: return GetRawButton(kLeftStickButtonNum); case kRightStickButton: return GetRawButton(kRightStickButtonNum); default: return false; } }
/** * Get the button value for the button set as the default trigger * * @param hand Unused * @return The state of the button. */ bool KinectStick::GetTrigger(JoystickHand hand) { return GetRawButton(kTriggerMask); }
/** * Get the button value for the button set as the default bumper (button 4) * * @param hand Unused * @return The state of the button. */ bool KinectStick::GetBumper(JoystickHand hand) { // TODO: Should this even be in GenericHID? Is 4 an appropriate mask value (button 3)? return GetRawButton(4); }
/** * Get buttons based on an enumerated type. * * The button type will be looked up in the list of buttons and then read. * * @param button The type of button to read. * @return The state of the button. */ bool Gamepad::GetButton(ButtonType button) { switch (button) { case kButton01: return GetRawButton( 1 ); case kButton02: return GetRawButton( 2 ); case kButton03: return GetRawButton( 3 ); case kButton04: return GetRawButton( 4 ); case kButton05: return GetRawButton( 5 ); case kButton06: return GetRawButton( 6 ); case kButton07: return GetRawButton( 7 ); case kButton08: return GetRawButton( 8 ); case kButton09: return GetRawButton( 9 ); case kButton10: return GetRawButton( 10 ); case kButton11: return GetRawButton( 11 ); case kButton12: return GetRawButton( 12 ); default: wpi_assert(false); return false; } }
/** * Read the state of button 12 on the gamepad. * * @return The state of the button. */ bool Gamepad::GetButton12(void) { return GetRawButton(m_buttons[kButton12]); }