Skip to content

Commit

Permalink
fix name collision
Browse files Browse the repository at this point in the history
  • Loading branch information
lightmanLP committed Dec 18, 2024
1 parent b1c5c65 commit 25cf01e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/controller/controldevice/controller/ControllerButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace Ship {
ControllerButton::ControllerButton(uint8_t portIndex, CONTROLLERBUTTONS_T bitmask)
: mPortIndex(portIndex), mBitmask(bitmask), mUseKeydownEventToCreateNewMapping(false),
mKeyboardScancodeForNewMapping(LUS_KB_UNKNOWN), mMouseButtonForNewMapping(MouseBtn::MOUSE_BTN_UNKNOWN) {
mKeyboardScancodeForNewMapping(LUS_KB_UNKNOWN), mMouseButtonForNewMapping(LUS_MOUSE_UNKNOWN) {
}

ControllerButton::~ControllerButton() {
Expand Down Expand Up @@ -181,7 +181,7 @@ bool ControllerButton::AddOrEditButtonMappingFromRawPress(CONTROLLERBUTTONS_T bi
mUseKeydownEventToCreateNewMapping = true;
if (mKeyboardScancodeForNewMapping != LUS_KB_UNKNOWN) {
mapping = std::make_shared<KeyboardKeyToButtonMapping>(mPortIndex, bitmask, mKeyboardScancodeForNewMapping);
} else if (!ImGui::IsAnyItemHovered() && mMouseButtonForNewMapping != MouseBtn::MOUSE_BTN_UNKNOWN) {
} else if (!ImGui::IsAnyItemHovered() && mMouseButtonForNewMapping != LUS_MOUSE_BTN_UNKNOWN) {
// TODO: I dont think direct ImGui calls should be here
mapping = std::make_shared<MouseButtonToButtonMapping>(mPortIndex, bitmask, mMouseButtonForNewMapping);
} else {
Expand All @@ -193,7 +193,7 @@ bool ControllerButton::AddOrEditButtonMappingFromRawPress(CONTROLLERBUTTONS_T bi
}

mKeyboardScancodeForNewMapping = LUS_KB_UNKNOWN;
mMouseButtonForNewMapping = MouseBtn::MOUSE_BTN_UNKNOWN;
mMouseButtonForNewMapping = LUS_MOUSE_BTN_UNKNOWN;
mUseKeydownEventToCreateNewMapping = false;

if (id != "") {
Expand Down Expand Up @@ -239,7 +239,7 @@ bool ControllerButton::ProcessMouseEvent(bool isPressed, MouseBtn button) {
mMouseButtonForNewMapping = button;
return true;
} else {
mMouseButtonForNewMapping = MouseBtn::MOUSE_BTN_UNKNOWN;
mMouseButtonForNewMapping = LUS_MOUSE_BTN_UNKNOWN;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/controller/controldevice/controller/ControllerStick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Ship {
ControllerStick::ControllerStick(uint8_t portIndex, StickIndex stickIndex)
: mPortIndex(portIndex), mStickIndex(stickIndex), mUseKeydownEventToCreateNewMapping(false),
mKeyboardScancodeForNewMapping(KbScancode::LUS_KB_UNKNOWN),
mMouseButtonForNewMapping(MouseBtn::MOUSE_BTN_UNKNOWN) {
mMouseButtonForNewMapping(LUS_MOUSE_BTN_UNKNOWN) {
mSensitivityPercentage = DEFAULT_STICK_SENSITIVITY_PERCENTAGE;
mSensitivity = 1.0f;
mDeadzonePercentage = DEFAULT_STICK_DEADZONE_PERCENTAGE;
Expand Down Expand Up @@ -276,7 +276,7 @@ bool ControllerStick::AddOrEditAxisDirectionMappingFromRawPress(Direction direct
if (mKeyboardScancodeForNewMapping != LUS_KB_UNKNOWN) {
mapping = std::make_shared<KeyboardKeyToAxisDirectionMapping>(mPortIndex, mStickIndex, direction,
mKeyboardScancodeForNewMapping);
} else if (!ImGui::IsAnyItemHovered() && mMouseButtonForNewMapping != MouseBtn::MOUSE_BTN_UNKNOWN) {
} else if (!ImGui::IsAnyItemHovered() && mMouseButtonForNewMapping != LUS_MOUSE_BTN_UNKNOWN) {
// TODO: I dont think direct ImGui calls should be here (again)
mapping = std::make_shared<MouseButtonToAxisDirectionMapping>(mPortIndex, mStickIndex, direction,
mMouseButtonForNewMapping);
Expand All @@ -290,7 +290,7 @@ bool ControllerStick::AddOrEditAxisDirectionMappingFromRawPress(Direction direct
}

mKeyboardScancodeForNewMapping = LUS_KB_UNKNOWN;
mMouseButtonForNewMapping = MouseBtn::MOUSE_BTN_UNKNOWN;
mMouseButtonForNewMapping = LUS_MOUSE_BTN_UNKNOWN;
mUseKeydownEventToCreateNewMapping = false;

if (id != "") {
Expand Down Expand Up @@ -356,7 +356,7 @@ bool ControllerStick::ProcessMouseEvent(bool isPressed, MouseBtn button) {
mMouseButtonForNewMapping = button;
return true;
} else {
mMouseButtonForNewMapping = MouseBtn::MOUSE_BTN_UNKNOWN;
mMouseButtonForNewMapping = LUS_MOUSE_BTN_UNKNOWN;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,15 @@ typedef enum KbScancode {
LUS_KB_MAX
} KbScancode;

typedef enum MouseBtn { LEFT, MIDDLE, RIGHT, BACKWARD, FORWARD, MOUSE_BTN_COUNT, MOUSE_BTN_UNKNOWN } MouseBtn;
typedef enum MouseBtn {
LUS_MOUSE_BTN_LEFT,
LUS_MOUSE_BTN_MIDDLE,
LUS_MOUSE_BTN_RIGHT,
LUS_MOUSE_BTN_BACKWARD,
LUS_MOUSE_BTN_FORWARD,
LUS_MOUSE_BTN_COUNT,
LUS_MOUSE_BTN_UNKNOWN
} MouseBtn;

#ifdef __cplusplus
static std::string mouseBtnNames[7] = { "MouseLeft", "MouseMiddle", "MouseRight", "MouseBackward",
Expand Down

0 comments on commit 25cf01e

Please sign in to comment.