Example of using SDL_BUTTON macro

Hi all,
Does anyone have a quick example of using the SDL_BUTTON macro with
the SDL_MouseMotionEvent structure. Using these combination how would I
find out which mouse button was pressed etc.

Thanks,

Dominique
http://www.DelphiGamer.com := for all your Object Pascal game
development needs;

Hi,

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.–
Marshall Lake – mlake at melake.erols.comhttp://melake.erols.com

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 :slight_smile:

Hope this is the info you were looking for …On Mon, 7 Jan 2002, Marshall Lake wrote:

Mike.