Fixed the SDL and Mouselook Problem

This is an old ar­ti­cle from 2011. I was a kid. I learned a lot since then, so please do think twice when tak­ing ad­vice from me as a kid.

Af­ter spend­ing hours try­ing to fig­ure out why my mouselook func­tion didn’t work with SDL, I fi­nal­ly got a so­lu­tion.

The prob­lem was that I didn’t use SDL_PumpEvents() be­fore call­ing SDL_Get­Mous­eS­tate(). But if I do that I get the next prob­lem: my Key­board Events get de­layed be­cause the event-queue got enor­mous.

In the end I de­cid­ed to put the mouse mo­tion han­dling in where I han­dled the SDL-events. That worked. I’ll post some code very soon, so if some­body has a sim­i­lar prob­lem, he/she doesn’t need to spend hours on it, as I did.

Greet­ings, Squareys

This post was im­port­ed from tum­blr

Tumblr

Archived blog posts from squareys.tum­blr.com.