mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 12:50:44 +00:00
Fix mouse warping
In some cases, the warp back to center was being detected as a mouse motion, causing all sorts of silliness with the mouse. The workaround is by only using the first motion event and ignoring every event after that, until the next call to I_GetEvent.
This commit is contained in:
parent
b82f64dea5
commit
0913bd44af
1 changed files with 5 additions and 1 deletions
|
@ -987,6 +987,9 @@ static void Impl_HandleJoystickButtonEvent(SDL_JoyButtonEvent evt, Uint32 type)
|
||||||
void I_GetEvent(void)
|
void I_GetEvent(void)
|
||||||
{
|
{
|
||||||
SDL_Event evt;
|
SDL_Event evt;
|
||||||
|
// We only want the first motion event,
|
||||||
|
// otherwise we'll end up catching the warp back to center.
|
||||||
|
int mouseMotionOnce = 0;
|
||||||
|
|
||||||
if (!graphics_started)
|
if (!graphics_started)
|
||||||
{
|
{
|
||||||
|
@ -1005,7 +1008,8 @@ void I_GetEvent(void)
|
||||||
Impl_HandleKeyboardEvent(evt.key, evt.type);
|
Impl_HandleKeyboardEvent(evt.key, evt.type);
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_MOUSEMOTION:
|
||||||
Impl_HandleMouseMotionEvent(evt.motion);
|
if (!mouseMotionOnce) Impl_HandleMouseMotionEvent(evt.motion);
|
||||||
|
mouseMotionOnce = 1;
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_MOUSEBUTTONUP:
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
|
|
Loading…
Reference in a new issue