With SDL 1.2 I was using SDL_WM_GrabInput to center the (hidden) mouse on screen. This gave me unlimited turning freedom for a first person shooter. SDL2 no longer provides this function but has SDL_SetWindowGrab. This does not seem to be repositioning the mouse to the center of the screen after each loop (event read). I can turn the player around only 1 and a half times before the mouse has hit the edge of the window and will no longer produce xrel values. Is this a bug or is there another function I should be using?
With SDL 1.2 I was using SDL_WM_GrabInput to center the (hidden) mouse on screen.
Share
Give
SDL_SetRelativeMouseMode()andSDL_GetRelativeMouseState()a try.Alternatively recenter the mouse each frame yourself with
SDL_WarpMouseInWindow().