Add gamepad level support for misc1 and touchpad buttons

This commit is contained in:
SenPie 2024-12-18 20:25:51 +04:00
parent e1925753fa
commit 7cd1ca7f88
4 changed files with 11 additions and 6 deletions

View File

@ -628,10 +628,12 @@ extern "C" {
#define GLFW_GAMEPAD_BUTTON_GUIDE 8 #define GLFW_GAMEPAD_BUTTON_GUIDE 8
#define GLFW_GAMEPAD_BUTTON_LEFT_THUMB 9 #define GLFW_GAMEPAD_BUTTON_LEFT_THUMB 9
#define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB 10 #define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB 10
#define GLFW_GAMEPAD_BUTTON_DPAD_UP 11 #define GLFW_GAMEPAD_BUTTON_MISC1 11
#define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT 12 #define GLFW_GAMEPAD_BUTTON_TOUCHPAD 12
#define GLFW_GAMEPAD_BUTTON_DPAD_DOWN 13 #define GLFW_GAMEPAD_BUTTON_DPAD_UP 13
#define GLFW_GAMEPAD_BUTTON_DPAD_LEFT 14 #define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT 14
#define GLFW_GAMEPAD_BUTTON_DPAD_DOWN 15
#define GLFW_GAMEPAD_BUTTON_DPAD_LEFT 16
#define GLFW_GAMEPAD_BUTTON_LAST GLFW_GAMEPAD_BUTTON_DPAD_LEFT #define GLFW_GAMEPAD_BUTTON_LAST GLFW_GAMEPAD_BUTTON_DPAD_LEFT
#define GLFW_GAMEPAD_BUTTON_CROSS GLFW_GAMEPAD_BUTTON_A #define GLFW_GAMEPAD_BUTTON_CROSS GLFW_GAMEPAD_BUTTON_A
@ -2116,7 +2118,7 @@ typedef struct GLFWgamepadstate
/*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS` /*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`
* or `GLFW_RELEASE`. * or `GLFW_RELEASE`.
*/ */
unsigned char buttons[15]; unsigned char buttons[17];
/*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0 /*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0
* to 1.0 inclusive. * to 1.0 inclusive.
*/ */

View File

@ -144,6 +144,8 @@ static GLFWbool parseMapping(_GLFWmapping* mapping, const char* string)
{ "rightshoulder", mapping->buttons + GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER }, { "rightshoulder", mapping->buttons + GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER },
{ "leftstick", mapping->buttons + GLFW_GAMEPAD_BUTTON_LEFT_THUMB }, { "leftstick", mapping->buttons + GLFW_GAMEPAD_BUTTON_LEFT_THUMB },
{ "rightstick", mapping->buttons + GLFW_GAMEPAD_BUTTON_RIGHT_THUMB }, { "rightstick", mapping->buttons + GLFW_GAMEPAD_BUTTON_RIGHT_THUMB },
{ "misc1", mapping->buttons + GLFW_GAMEPAD_BUTTON_MISC1 },
{ "touchpad", mapping->buttons + GLFW_GAMEPAD_BUTTON_TOUCHPAD },
{ "dpup", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_UP }, { "dpup", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_UP },
{ "dpright", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_RIGHT }, { "dpright", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_RIGHT },
{ "dpdown", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_DOWN }, { "dpdown", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_DOWN },

View File

@ -636,7 +636,7 @@ struct _GLFWmapping
{ {
char name[128]; char name[128];
char guid[33]; char guid[33];
_GLFWmapelement buttons[15]; _GLFWmapelement buttons[17];
_GLFWmapelement axes[6]; _GLFWmapelement axes[6];
}; };

View File

@ -299,6 +299,7 @@ int main(void)
"LB", "RB", "LB", "RB",
"Back", "Start", "Guide", "Back", "Start", "Guide",
"LT", "RT", "LT", "RT",
"MISC1", "TOUCHPAD"
}; };
nk_labelf(nk, NK_TEXT_LEFT, nk_labelf(nk, NK_TEXT_LEFT,