SDL_CaptureMouse() is available since SDL 2.0.4.

This commit is contained in:
Thomas Bernard 2019-02-09 05:05:26 +01:00
parent bf16f3fe7d
commit 96c6ce2221
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -1318,9 +1318,10 @@ int Get_input(int sleep_time)
break; break;
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
#ifdef USE_SDL2 #if defined(USE_SDL2) && SDL_VERSION_ATLEAST(2, 0, 4)
// SDL_CaptureMouse() is available since SDL 2.0.4.
SDL_CaptureMouse(SDL_TRUE); SDL_CaptureMouse(SDL_TRUE);
#else #elif defined(USE_SDL)
SDL_WM_GrabInput(SDL_GRAB_ON); SDL_WM_GrabInput(SDL_GRAB_ON);
#endif #endif
Handle_mouse_click(&event.button); Handle_mouse_click(&event.button);
@ -1328,9 +1329,10 @@ int Get_input(int sleep_time)
break; break;
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
#ifdef USE_SDL2 #if defined(USE_SDL2) && SDL_VERSION_ATLEAST(2, 0, 4)
// SDL_CaptureMouse() is available since SDL 2.0.4.
SDL_CaptureMouse(SDL_FALSE); SDL_CaptureMouse(SDL_FALSE);
#else #elif defined(USE_SDL)
SDL_WM_GrabInput(SDL_GRAB_OFF); SDL_WM_GrabInput(SDL_GRAB_OFF);
#endif #endif
Handle_mouse_release(&event.button); Handle_mouse_release(&event.button);