[wpilib,cmd] Rename gamepad shoulder to bumper (#8573)

Both programs used bumper, so we shouldn't rename it. There's no reason
to change it, and we don't need to match SDL.
This commit is contained in:
Thad House
2026-02-07 10:39:22 -08:00
committed by GitHub
parent 19c61cc419
commit 4aa21e947d
24 changed files with 179 additions and 182 deletions

View File

@@ -202,37 +202,36 @@ BooleanEvent Gamepad::RightStick(EventLoop* loop) const {
return BooleanEvent(loop, [this]() { return this->GetRightStickButton(); });
}
bool Gamepad::GetLeftShoulderButton() const {
return GetRawButton(Button::kLeftShoulder);
bool Gamepad::GetLeftBumperButton() const {
return GetRawButton(Button::kLeftBumper);
}
bool Gamepad::GetLeftShoulderButtonPressed() {
return GetRawButtonPressed(Button::kLeftShoulder);
bool Gamepad::GetLeftBumperButtonPressed() {
return GetRawButtonPressed(Button::kLeftBumper);
}
bool Gamepad::GetLeftShoulderButtonReleased() {
return GetRawButtonReleased(Button::kLeftShoulder);
bool Gamepad::GetLeftBumperButtonReleased() {
return GetRawButtonReleased(Button::kLeftBumper);
}
BooleanEvent Gamepad::LeftShoulder(EventLoop* loop) const {
return BooleanEvent(loop, [this]() { return this->GetLeftShoulderButton(); });
BooleanEvent Gamepad::LeftBumper(EventLoop* loop) const {
return BooleanEvent(loop, [this]() { return this->GetLeftBumperButton(); });
}
bool Gamepad::GetRightShoulderButton() const {
return GetRawButton(Button::kRightShoulder);
bool Gamepad::GetRightBumperButton() const {
return GetRawButton(Button::kRightBumper);
}
bool Gamepad::GetRightShoulderButtonPressed() {
return GetRawButtonPressed(Button::kRightShoulder);
bool Gamepad::GetRightBumperButtonPressed() {
return GetRawButtonPressed(Button::kRightBumper);
}
bool Gamepad::GetRightShoulderButtonReleased() {
return GetRawButtonReleased(Button::kRightShoulder);
bool Gamepad::GetRightBumperButtonReleased() {
return GetRawButtonReleased(Button::kRightBumper);
}
BooleanEvent Gamepad::RightShoulder(EventLoop* loop) const {
return BooleanEvent(loop,
[this]() { return this->GetRightShoulderButton(); });
BooleanEvent Gamepad::RightBumper(EventLoop* loop) const {
return BooleanEvent(loop, [this]() { return this->GetRightBumperButton(); });
}
bool Gamepad::GetDpadUpButton() const {
@@ -528,11 +527,11 @@ void Gamepad::InitSendable(wpi::util::SendableBuilder& builder) {
"RightStick",
[this] { return GetButtonForSendable(Button::kRightStick); }, nullptr);
builder.AddBooleanProperty(
"LeftShoulder",
[this] { return GetButtonForSendable(Button::kLeftShoulder); }, nullptr);
"LeftBumper",
[this] { return GetButtonForSendable(Button::kLeftBumper); }, nullptr);
builder.AddBooleanProperty(
"RightShoulder",
[this] { return GetButtonForSendable(Button::kRightShoulder); }, nullptr);
"RightBumper",
[this] { return GetButtonForSendable(Button::kRightBumper); }, nullptr);
builder.AddBooleanProperty(
"DpadUp", [this] { return GetButtonForSendable(Button::kDpadUp); },
nullptr);

View File

@@ -81,12 +81,12 @@ void GamepadSim::SetRightStickButton(bool value) {
SetRawButton(Gamepad::Button::kRightStick, value);
}
void GamepadSim::SetLeftShoulderButton(bool value) {
SetRawButton(Gamepad::Button::kLeftShoulder, value);
void GamepadSim::SetLeftBumperButton(bool value) {
SetRawButton(Gamepad::Button::kLeftBumper, value);
}
void GamepadSim::SetRightShoulderButton(bool value) {
SetRawButton(Gamepad::Button::kRightShoulder, value);
void GamepadSim::SetRightBumperButton(bool value) {
SetRawButton(Gamepad::Button::kRightBumper, value);
}
void GamepadSim::SetDpadUpButton(bool value) {

View File

@@ -409,66 +409,66 @@ class Gamepad : public GenericHID,
BooleanEvent RightStick(EventLoop* loop) const;
/**
* Read the value of the right shoulder button on the controller.
* Read the value of the right bumper button on the controller.
*
* @return The state of the button.
*/
bool GetLeftShoulderButton() const;
bool GetLeftBumperButton() const;
/**
* Whether the right shoulder button was pressed since the last check.
* Whether the right bumper button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetLeftShoulderButtonPressed();
bool GetLeftBumperButtonPressed();
/**
* Whether the right shoulder button was released since the last check.
* Whether the right bumper button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetLeftShoulderButtonReleased();
bool GetLeftBumperButtonReleased();
/**
* Constructs an event instance around the right shoulder button's
* Constructs an event instance around the right bumper button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the right shoulder button's
* @return an event instance representing the right bumper button's
* digital signal attached to the given loop.
*/
BooleanEvent LeftShoulder(EventLoop* loop) const;
BooleanEvent LeftBumper(EventLoop* loop) const;
/**
* Read the value of the right shoulder button on the controller.
* Read the value of the right bumper button on the controller.
*
* @return The state of the button.
*/
bool GetRightShoulderButton() const;
bool GetRightBumperButton() const;
/**
* Whether the right shoulder button was pressed since the last check.
* Whether the right bumper button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetRightShoulderButtonPressed();
bool GetRightBumperButtonPressed();
/**
* Whether the right shoulder button was released since the last check.
* Whether the right bumper button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetRightShoulderButtonReleased();
bool GetRightBumperButtonReleased();
/**
* Constructs an event instance around the right shoulder button's
* Constructs an event instance around the right bumper button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the right shoulder button's
* @return an event instance representing the right bumper button's
* digital signal attached to the given loop.
*/
BooleanEvent RightShoulder(EventLoop* loop) const;
BooleanEvent RightBumper(EventLoop* loop) const;
/**
* Read the value of the D-pad up button on the controller.
@@ -955,10 +955,10 @@ class Gamepad : public GenericHID,
static constexpr int kLeftStick = 7;
/// Right stick button.
static constexpr int kRightStick = 8;
/// Right shoulder button.
static constexpr int kLeftShoulder = 9;
/// Right shoulder button.
static constexpr int kRightShoulder = 10;
/// right bumper button.
static constexpr int kLeftBumper = 9;
/// right bumper button.
static constexpr int kRightBumper = 10;
/// D-pad up button.
static constexpr int kDpadUp = 11;
/// D-pad down button.

View File

@@ -137,18 +137,18 @@ class GamepadSim : public GenericHIDSim {
void SetRightStickButton(bool value);
/**
* Change the value of the right shoulder button on the controller.
* Change the value of the right bumper button on the controller.
*
* @param value the new value
*/
void SetLeftShoulderButton(bool value);
void SetLeftBumperButton(bool value);
/**
* Change the value of the right shoulder button on the controller.
* Change the value of the right bumper button on the controller.
*
* @param value the new value
*/
void SetRightShoulderButton(bool value);
void SetRightBumperButton(bool value);
/**
* Change the value of the D-pad up button on the controller.