6
\$\begingroup\$

When using SDL 1.2 it the way to implement full screen or windowed applications with "no cursor" you did the following:

SDL_ShowCursor(SDL_DISABLE);
SDL_WM_GrabInput(SDL_GRAB_ON);

See Trap mouse in SDL

Unfortunately I am unable to get the same behavior with SDL 2.0. I implemented the above as:

SDL_Window* window;
// ...
SDL_ShowCursor(SDL_DISABLE);
SDL_SetWindowGrab(window, SDL_TRUE);

Am I missing something or do you have to wrap the cursor manually back to the center of the window/screen?

\$\endgroup\$
10
\$\begingroup\$

The solution is SDL_SetRelativeMouseMode. How can I have missed that.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.