mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-02 14:01:26 +00:00
Fix MacOS mouse grabbing issue
Fixes https://github.com/sezero/quakespasm/issues/48 by centering the mouse on the window prior to grabbing it.
This commit is contained in:
parent
aa3cfce04d
commit
88d9a8f45d
1 changed files with 9 additions and 0 deletions
|
@ -212,6 +212,15 @@ void IN_Activate (void)
|
|||
#endif
|
||||
|
||||
#if defined(USE_SDL2)
|
||||
#ifdef __APPLE__
|
||||
{
|
||||
// Work around https://github.com/sezero/quakespasm/issues/48
|
||||
int width, height;
|
||||
SDL_GetWindowSize((SDL_Window*) VID_GetWindow(), &width, &height);
|
||||
SDL_WarpMouseInWindow((SDL_Window*) VID_GetWindow(), width / 2, height / 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (SDL_SetRelativeMouseMode(SDL_TRUE) != 0)
|
||||
{
|
||||
Con_Printf("WARNING: SDL_SetRelativeMouseMode(SDL_TRUE) failed.\n");
|
||||
|
|
Loading…
Reference in a new issue