Preventing SDL mouse from leaving the window

Started by
1 comment, last by MadsGustaf 16 years, 1 month ago
On the top of my head i would think it would be easy to do, as i could just do

 if( event.motion.x <= 0)
 {
  SDL_WarpMouse(0,event.motion.y);
 }
But it turns out, whenever i leave the boundaries of the created window with the mouse, event.motion.x will always return 0. I have seen games doing this so i know it is possible.
•°*”˜˜”*°•.˜”*°•..•°*”˜.•°*”˜˜”*°•..•°*”˜˜”*°•.˜”*°•.˜”*°•. Mads .•°*”˜.•°*”˜.•°*”˜˜”*°•.˜”*°•..•°*”˜.•°*”˜.•°*”˜ ˜”*°•.˜”*°•.˜”*°•..•°*”˜I am going to live forever... or die trying!
Advertisement
Is SDL_WM_GrabInput what you're looking for?
exactly! :D works like a charm!
++ratin
•°*”˜˜”*°•.˜”*°•..•°*”˜.•°*”˜˜”*°•..•°*”˜˜”*°•.˜”*°•.˜”*°•. Mads .•°*”˜.•°*”˜.•°*”˜˜”*°•.˜”*°•..•°*”˜.•°*”˜.•°*”˜ ˜”*°•.˜”*°•.˜”*°•..•°*”˜I am going to live forever... or die trying!

This topic is closed to new replies.

Advertisement