diff --git a/examples/core/core_input_mouse.c b/examples/core/core_input_mouse.c index ad205aed8..fe1bdfb68 100644 --- a/examples/core/core_input_mouse.c +++ b/examples/core/core_input_mouse.c @@ -36,6 +36,10 @@ int main(void) if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) ballColor = MAROON; else if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) ballColor = LIME; else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE; + else if (IsMouseButtonPressed(MOUSE_SIDE_BUTTON)) ballColor = PURPLE; + else if (IsMouseButtonPressed(MOUSE_EXTRA_BUTTON)) ballColor = YELLOW; + else if (IsMouseButtonPressed(MOUSE_FORWARD_BUTTON)) ballColor = ORANGE; + else if (IsMouseButtonPressed(MOUSE_BACK_BUTTON)) ballColor = BEIGE; //---------------------------------------------------------------------------------- // Draw diff --git a/src/core.c b/src/core.c index e0987928c..4c5ca5ccf 100644 --- a/src/core.c +++ b/src/core.c @@ -438,12 +438,12 @@ typedef struct CoreData { bool cursorHidden; // Track if cursor is hidden bool cursorOnScreen; // Tracks if cursor is inside client area - char currentButtonState[3]; // Registers current mouse button state - char previousButtonState[3]; // Registers previous mouse button state + char currentButtonState[MOUSE_BUTTON_MAX]; // Registers current mouse button state + char previousButtonState[MOUSE_BUTTON_MAX]; // Registers previous mouse button state float currentWheelMove; // Registers current mouse wheel variation float previousWheelMove; // Registers previous mouse wheel variation #if defined(PLATFORM_RPI) || defined(PLATFORM_DRM) - char currentButtonStateEvdev[3]; // Holds the new mouse state for the next polling event to grab (Can't be written directly due to multithreading, app could miss the update) + char currentButtonStateEvdev[MOUSE_BUTTON_MAX]; // Holds the new mouse state for the next polling event to grab (Can't be written directly due to multithreading, app could miss the update) #endif } Mouse; struct { @@ -6104,6 +6104,10 @@ static void *EventThread(void *arg) if (event.code == BTN_RIGHT) CORE.Input.Mouse.currentButtonStateEvdev[MOUSE_RIGHT_BUTTON] = event.value; if (event.code == BTN_MIDDLE) CORE.Input.Mouse.currentButtonStateEvdev[MOUSE_MIDDLE_BUTTON] = event.value; + if (event.code == BTN_SIDE) CORE.Input.Mouse.currentButtonStateEvdev[MOUSE_SIDE_BUTTON] = event.value; + if (event.code == BTN_EXTRA) CORE.Input.Mouse.currentButtonStateEvdev[MOUSE_EXTRA_BUTTON] = event.value; + if (event.code == BTN_FORWARD) CORE.Input.Mouse.currentButtonStateEvdev[MOUSE_FORWARD_BUTTON] = event.value; + if (event.code == BTN_BACK) CORE.Input.Mouse.currentButtonStateEvdev[MOUSE_BACK_BUTTON] = event.value; } // Screen confinement diff --git a/src/raylib.h b/src/raylib.h index bb67c1265..a9eca835b 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -639,9 +639,14 @@ typedef enum { // Mouse buttons typedef enum { - MOUSE_LEFT_BUTTON = 0, - MOUSE_RIGHT_BUTTON = 1, - MOUSE_MIDDLE_BUTTON = 2 + MOUSE_LEFT_BUTTON = 0, + MOUSE_RIGHT_BUTTON = 1, + MOUSE_MIDDLE_BUTTON = 2, + MOUSE_SIDE_BUTTON = 3, + MOUSE_EXTRA_BUTTON = 4, + MOUSE_FORWARD_BUTTON = 5, + MOUSE_BACK_BUTTON = 6, + MOUSE_BUTTON_MAX = 7 } MouseButton; // Mouse cursor