From 25cf01e52bfc0d1b9062694cc9500ae76c2ed280 Mon Sep 17 00:00:00 2001 From: lightmanLP <50497969+lightmanLP@users.noreply.github.com> Date: Wed, 18 Dec 2024 08:50:15 +0000 Subject: [PATCH] fix name collision --- .../controldevice/controller/ControllerButton.cpp | 8 ++++---- .../controldevice/controller/ControllerStick.cpp | 8 ++++---- .../controller/mapping/keyboard/KeyboardScancodes.h | 10 +++++++++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/controller/controldevice/controller/ControllerButton.cpp b/src/controller/controldevice/controller/ControllerButton.cpp index a127b6cb7..2766e4543 100644 --- a/src/controller/controldevice/controller/ControllerButton.cpp +++ b/src/controller/controldevice/controller/ControllerButton.cpp @@ -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() { @@ -181,7 +181,7 @@ bool ControllerButton::AddOrEditButtonMappingFromRawPress(CONTROLLERBUTTONS_T bi mUseKeydownEventToCreateNewMapping = true; if (mKeyboardScancodeForNewMapping != LUS_KB_UNKNOWN) { mapping = std::make_shared(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(mPortIndex, bitmask, mMouseButtonForNewMapping); } else { @@ -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 != "") { @@ -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; } } diff --git a/src/controller/controldevice/controller/ControllerStick.cpp b/src/controller/controldevice/controller/ControllerStick.cpp index 3ad3c6a0f..a2593801c 100644 --- a/src/controller/controldevice/controller/ControllerStick.cpp +++ b/src/controller/controldevice/controller/ControllerStick.cpp @@ -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; @@ -276,7 +276,7 @@ bool ControllerStick::AddOrEditAxisDirectionMappingFromRawPress(Direction direct if (mKeyboardScancodeForNewMapping != LUS_KB_UNKNOWN) { mapping = std::make_shared(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(mPortIndex, mStickIndex, direction, mMouseButtonForNewMapping); @@ -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 != "") { @@ -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; } } diff --git a/src/controller/controldevice/controller/mapping/keyboard/KeyboardScancodes.h b/src/controller/controldevice/controller/mapping/keyboard/KeyboardScancodes.h index 601b29b20..f1e9b70b5 100644 --- a/src/controller/controldevice/controller/mapping/keyboard/KeyboardScancodes.h +++ b/src/controller/controldevice/controller/mapping/keyboard/KeyboardScancodes.h @@ -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",