Linux/macOS: Support 4 extra buttons, partially addresses #1186

This commit is contained in:
UnknownShadow200 2024-05-16 17:20:17 +10:00
parent 29859ca9ab
commit a3e559add9
4 changed files with 24 additions and 5 deletions

View File

@ -216,7 +216,8 @@ static const char* const storageNames[INPUT_COUNT] = {
"Keypad5", "Keypad6", "Keypad7", "Keypad8", "Keypad9",
"KeypadDivide", "KeypadMultiply", "KeypadSubtract",
"KeypadAdd", "KeypadDecimal", "KeypadEnter",
"XButton1", "XButton2", "LeftMouse", "RightMouse", "MiddleMouse",
"XButton1", "XButton2", "XButton3", "XButton4", "XButton5", "XButton6",
"LeftMouse", "RightMouse", "MiddleMouse",
Pad_Names
};
@ -239,7 +240,8 @@ const char* const Input_DisplayNames[INPUT_COUNT] = {
"NUMPAD5", "NUMPAD6", "NUMPAD7", "NUMPAD8", "NUMPAD9",
"DIVIDE", "MULTIPLY", "SUBTRACT",
"ADD", "DECIMAL", "NUMPADENTER",
"XBUTTON1", "XBUTTON2", "LMOUSE", "RMOUSE", "MMOUSE",
"XBUTTON1", "XBUTTON2", "XBUTTON3", "XBUTTON4", "XBUTTON5", "XBUTTON6",
"LMOUSE", "RMOUSE", "MMOUSE",
Pad_Names
};

View File

@ -43,7 +43,8 @@ enum InputButtons {
CCKEY_KP_PLUS, CCKEY_KP_DECIMAL, CCKEY_KP_ENTER,
/* NOTE: RMOUSE must be before MMOUSE for PlayerClick compatibility */
CCMOUSE_X1, CCMOUSE_X2, CCMOUSE_L, CCMOUSE_R, CCMOUSE_M,
CCMOUSE_X1, CCMOUSE_X2, CCMOUSE_X3, CCMOUSE_X4, CCMOUSE_X5, CCMOUSE_X6,
CCMOUSE_L, CCMOUSE_R, CCMOUSE_M,
CCPAD_A, CCPAD_B, CCPAD_X, CCPAD_Y, CCPAD_L, CCPAD_R, CCPAD_Z,
CCPAD_LEFT, CCPAD_RIGHT, CCPAD_UP, CCPAD_DOWN,

View File

@ -474,8 +474,17 @@ static int MapNativeMouse(int button) {
if (button == 1) return CCMOUSE_L;
if (button == 2) return CCMOUSE_M;
if (button == 3) return CCMOUSE_R;
if (button == 8) return CCMOUSE_X1;
if (button == 9) return CCMOUSE_X2;
if (button == 8) return CCMOUSE_X1;
if (button == 9) return CCMOUSE_X2;
if (button == 10) return CCMOUSE_X3;
if (button == 11) return CCMOUSE_X4;
if (button == 12) return CCMOUSE_X5;
if (button == 13) return CCMOUSE_X6;
/* Mouse horizontal and vertical scroll */
if (button >= 4 && button <= 7) return 0;
Platform_Log1("Unknown mouse button: %i", &button);
return 0;
}

View File

@ -434,8 +434,15 @@ static int MapNativeMouse(long button) {
if (button == 0) return CCMOUSE_L;
if (button == 1) return CCMOUSE_R;
if (button == 2) return CCMOUSE_M;
if (button == 3) return CCMOUSE_X1;
if (button == 4) return CCMOUSE_X2;
if (button == 5) return CCMOUSE_X3;
if (button == 6) return CCMOUSE_X4;
if (button == 7) return CCMOUSE_X5;
if (button == 8) return CCMOUSE_X6;
Platform_Log1("Unknown mouse button: %i", &button);
return 0;
}