SDL_GetMouseState()

I forget whether this had already been addressed. Apologies if it has.

The documentation for SDL_GetMouseState() says it takes two Uint16
pointers. Indeed, that coincides with the SDL_MouseMotionEvent structure
containing the x and y positions of the mouse.

The code, however, has SDL_GetMouseState() taking two int pointers.

Has this already been addressed?

Paul Braman
@Paul_Braman

I forget whether this had already been addressed. Apologies if it has.

The documentation for SDL_GetMouseState() says it takes two Uint16
pointers. Indeed, that coincides with the SDL_MouseMotionEvent structure
containing the x and y positions of the mouse.

The code, however, has SDL_GetMouseState() taking two int pointers.

Has this already been addressed?

Mmmm, need to update the documentation.

Thanks!
-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Hello,

problem:

Uint8 mousestate;

some_loop {

SDL_PumpEvents();

mousestate = SDL_GetMouseState(NULL, NULL);

if (mousestate[_______]) quit = TRUE;

}

on the
if (mousestate[______]) quit = TRUE;
line, where are the definitions for this (this being _______)? i
couldn’t find them in the SDL docs. anybody know how to check that Uint8
for various mouse states?
Thanks.–
Chris Thielen
@Christopher_Thielen

if (mousestate[______]) quit = TRUE;
line, where are the definitions for this (this being _______)? i
couldn’t find them in the SDL docs. anybody know how to check that Uint8
for various mouse states?
Thanks.

From the SDL_GetMouseState man page:

EXAMPLE
SDL_PumpEvents();
if(SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
printf(“Mouse Button 1(left) is pressed.”);

–ryan.

I find a solution :
If I write
SDL_GetMouseState(&mouseX,&mouseY);
before
SDL_PollEvent(&event);

if(event.key.keysym.sym == SDLK_t)
rotx += 0.9f;
…etc,

in my SDL-OpenGL program, it run with no problem .But when I put
SDL_GetMouseState() after checking events with SDL_PollEvent() the program
bugs.
Thanks for your help :expressionless: