Implemented mouse relative mode on Mac OS X.
This commit is contained in:
parent
9959455aee
commit
cde0d1bc03
5 changed files with 53 additions and 22 deletions
|
@ -308,8 +308,18 @@ SDL_SetRelativeMouseMode(SDL_bool enabled)
|
|||
{
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
|
||||
/* Flush pending mouse motion */
|
||||
SDL_FlushEvent(SDL_MOUSEMOTION);
|
||||
if (enabled == mouse->relative_mode) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!mouse->SetRelativeMouseMode) {
|
||||
SDL_Unsupported();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mouse->SetRelativeMouseMode(enabled) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Set the relative mode */
|
||||
mouse->relative_mode = enabled;
|
||||
|
@ -319,6 +329,9 @@ SDL_SetRelativeMouseMode(SDL_bool enabled)
|
|||
SDL_WarpMouseInWindow(mouse->focus, mouse->x, mouse->y);
|
||||
}
|
||||
|
||||
/* Flush pending mouse motion */
|
||||
SDL_FlushEvent(SDL_MOUSEMOTION);
|
||||
|
||||
/* Update cursor visibility */
|
||||
SDL_SetCursor(NULL);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue