Showing only posts tagged input. Show all posts.

Mouselook and SDL - Code

Okay, here is some code for mouselook with SDL

struct {
              int x, y;
              //In this case: the position where the mouse is held at
              bool trap; //flag for holding mouse at one place
          } mouse;

          void MouseMotion(){
              /* Set x and y to the current mouse position */
              int x, y;
              SDL_GetMouseState(&x …

Fixed the SDL and Mouselook Problem

After spending hours trying to figure out why my mouselook function didn’t work with SDL, I finally got a solution.

The problem was that I didn’t use SDL_PumpEvents() before calling SDL_GetMouseState(). But if I do that I get the next problem: my Keyboard Events get delayed because the …