mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Grab mouse on game startup
This commit is contained in:
parent
30bc8af7e8
commit
d4a2483c3e
1 changed files with 8 additions and 1 deletions
|
|
@ -639,11 +639,14 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type)
|
|||
|
||||
static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
|
||||
{
|
||||
static boolean firstmove = true;
|
||||
|
||||
if (USE_MOUSEINPUT)
|
||||
{
|
||||
if ((SDL_GetMouseFocus() != window && SDL_GetKeyboardFocus() != window) || IGNORE_MOUSE)
|
||||
if ((SDL_GetMouseFocus() != window && SDL_GetKeyboardFocus() != window) || (IGNORE_MOUSE && !firstmove))
|
||||
{
|
||||
SDLdoUngrabMouse();
|
||||
firstmove = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -657,6 +660,7 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
|
|||
mousemovey += -evt.yrel;
|
||||
SDL_SetWindowGrab(window, SDL_TRUE);
|
||||
}
|
||||
firstmove = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -664,6 +668,7 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
|
|||
// of the screen then ignore it.
|
||||
if ((evt.x == realwidth/2) && (evt.y == realheight/2))
|
||||
{
|
||||
firstmove = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -676,6 +681,8 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
|
|||
SDLdoGrabMouse();
|
||||
}
|
||||
}
|
||||
|
||||
firstmove = false;
|
||||
}
|
||||
|
||||
static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue