Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


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_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?

share|improve this question
up vote 6 down vote accepted

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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