[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:
parent
84818c96f2
commit
73363f829b
1 changed files with 35 additions and 22 deletions
|
@ -531,6 +531,13 @@ void PollInputEvents(void)
|
|||
// Reset key repeats
|
||||
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
|
||||
CORE.Input.Gamepad.lastButtonPressed = GAMEPAD_BUTTON_UNKNOWN;
|
||||
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;
|
||||
}
|
||||
|
||||
// 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
|
||||
//-----------------------------------------------------------------------------
|
||||
/*
|
||||
|
@ -606,7 +616,10 @@ void PollInputEvents(void)
|
|||
{
|
||||
CORE.Input.Mouse.currentButtonState[event.button.button - 1] = 1;
|
||||
} break;
|
||||
case SDL_MOUSEBUTTONUP: break;
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
{
|
||||
CORE.Input.Mouse.currentButtonState[event.button.button - 1] = 0;
|
||||
} break;
|
||||
case SDL_MOUSEWHEEL:
|
||||
{
|
||||
CORE.Input.Mouse.currentWheelMove.x = (float)event.wheel.x;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue