nckshr
nckshr

Reputation: 41

SDL2 relative mouse mode reporting motion when mouse has not been moved

I'm new to SDL2, so pardon any ignorance, but I am experiencing strange results when using relative mouse mode in SDL2.0.3. When I do SDL_SetRelativeMouseMode(SDL_bool::SDL_true), the cursor is hidden as expected. Inside the event loop, I check for windowEvent.type == SDL_MOUSEMOTION and then use windowEvent.motion.xrel/yrel xrel and yrel report values from -4 to 4 when the mouse is not even moving! Furthermore, actually moving my mouse does not seem to correlate whatsoever to the xrel and yrel's being reported.

Should I be doing this differently?

Upvotes: 4

Views: 3885

Answers (1)

Saiph
Saiph

Reputation: 520

I have the exact same problem on my computer, but using Uint32 SDL_GetRelativeMouseState(int* x,int* y) instead works fine.

Upvotes: 3

Related Questions