[SDL] Example of using SDL_BUTTON macro...
Mike
rapacity at gingin.net
Mon Jan 7 12:29:00 PST 2002
On Mon, 7 Jan 2002, Marshall Lake wrote:
> I'm a newbie to SDL. I'm wondering if you ever got a response to your
> query on the SDL list about example
> code for using SDL_BUTTON ? For some reason I can't get it to work for
> me.
Just from looking at the definition in SDL_mouse.h I gather you use it as a
mask against the current button state. If you're just responding to the
button down events you receive you don't need to use it (AFAIK)
Example I think might be:
int button, x, y;
button = SDL_GetMouseState (&x, &y);
if (button & SDL_BUTTON(1))
printf ("Button 1 is down, at (%d,%d)\n", x,y);
if (button & SDL_BUTTON(2))
printf ("Button 2 is down, at (%d,%d)\n", x,y);
SDL_GetMouseState() returns the button status as a bitmask, if you didn't
work that out from the above :-)
Hope this is the info you were looking for ...
--
Mike.
More information about the SDL
mailing list