mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-06 03:18:14 +00:00
[core] Fix some mouse issues on SDL
(#3428)
* Fix mouse wheel getting stucked scrolling up or down * Fix mouse movement on 3D * Fix mouse button presses
This commit is contained in:
@@ -531,6 +531,13 @@ void PollInputEvents(void)
|
|||||||
// Reset key repeats
|
// Reset key repeats
|
||||||
for (int i = 0; i < MAX_KEYBOARD_KEYS; i++) CORE.Input.Keyboard.keyRepeatInFrame[i] = 0;
|
for (int i = 0; i < MAX_KEYBOARD_KEYS; i++) CORE.Input.Keyboard.keyRepeatInFrame[i] = 0;
|
||||||
|
|
||||||
|
// Reset mouse wheel
|
||||||
|
CORE.Input.Mouse.currentWheelMove.x = 0;
|
||||||
|
CORE.Input.Mouse.currentWheelMove.y = 0;
|
||||||
|
|
||||||
|
// Register previous mouse position
|
||||||
|
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
||||||
|
|
||||||
// Reset last gamepad button/axis registered state
|
// Reset last gamepad button/axis registered state
|
||||||
CORE.Input.Gamepad.lastButtonPressed = GAMEPAD_BUTTON_UNKNOWN;
|
CORE.Input.Gamepad.lastButtonPressed = GAMEPAD_BUTTON_UNKNOWN;
|
||||||
for (int i = 0; i < MAX_GAMEPADS; i++) CORE.Input.Gamepad.axisCount[i] = 0;
|
for (int i = 0; i < MAX_GAMEPADS; i++) CORE.Input.Gamepad.axisCount[i] = 0;
|
||||||
@@ -551,6 +558,9 @@ void PollInputEvents(void)
|
|||||||
CORE.Input.Keyboard.keyRepeatInFrame[i] = 0;
|
CORE.Input.Keyboard.keyRepeatInFrame[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Register previous mouse states
|
||||||
|
for (int i = 0; i < MAX_MOUSE_BUTTONS; i++) CORE.Input.Mouse.previousButtonState[i] = CORE.Input.Mouse.currentButtonState[i];
|
||||||
|
|
||||||
// Poll input events for current plaform
|
// Poll input events for current plaform
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
@@ -606,7 +616,10 @@ void PollInputEvents(void)
|
|||||||
{
|
{
|
||||||
CORE.Input.Mouse.currentButtonState[event.button.button - 1] = 1;
|
CORE.Input.Mouse.currentButtonState[event.button.button - 1] = 1;
|
||||||
} break;
|
} break;
|
||||||
case SDL_MOUSEBUTTONUP: break;
|
case SDL_MOUSEBUTTONUP:
|
||||||
|
{
|
||||||
|
CORE.Input.Mouse.currentButtonState[event.button.button - 1] = 0;
|
||||||
|
} break;
|
||||||
case SDL_MOUSEWHEEL:
|
case SDL_MOUSEWHEEL:
|
||||||
{
|
{
|
||||||
CORE.Input.Mouse.currentWheelMove.x = (float)event.wheel.x;
|
CORE.Input.Mouse.currentWheelMove.x = (float)event.wheel.x;
|
||||||
|
Reference in New Issue
Block a user