diff options
| author | Ray <[email protected]> | 2020-03-02 00:07:06 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2020-03-02 00:07:06 +0100 |
| commit | 2f5a7ddcc6a5cbc16261d0cacb77ca9c0e972fc0 (patch) | |
| tree | c9a32b2726c128fd97baf868dc288e421b9382d2 | |
| parent | 18a99821268d7118f300e9c6f8f11371f84f86de (diff) | |
| download | raylib-2f5a7ddcc6a5cbc16261d0cacb77ca9c0e972fc0.tar.gz raylib-2f5a7ddcc6a5cbc16261d0cacb77ca9c0e972fc0.zip | |
Added comment on IsMouseButtonDown() issue
IsMouseButtonDown() does not process touch state down properly, state is reseted every frame...
| -rw-r--r-- | src/core.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -2522,9 +2522,16 @@ bool IsMouseButtonDown(int button) if (IsGestureDetected(GESTURE_HOLD)) down = true; #else if (glfwGetMouseButton(CORE.Window.handle, button)) down = true; + + // WARNING: currentButtonState is filled by an event callback and + // reseted every frame (moving value to previousButtonState), consequently, + // if button is kept down, it is not properly detected using currentButtonState + // Same issue happens with touch events, they should be stycky an not reseted //if (CORE.Input.Mouse.currentButtonState[button] == 1) down = true; // Map touches to mouse buttons checking + // WARNING: currentTouchState is reseted every frame and only + // refilled on mouse event (not tracking stationary state properly!) if (CORE.Input.Touch.currentTouchState[button] == 1) down = true; #endif @@ -4008,7 +4015,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i static void MouseButtonCallback(GLFWwindow *window, int button, int action, int mods) { CORE.Input.Mouse.currentButtonState[button] = action; - + #if defined(SUPPORT_GESTURES_SYSTEM) && defined(SUPPORT_MOUSE_GESTURES) // Process mouse events as touches to be able to use mouse-gestures GestureEvent gestureEvent = { 0 }; |
