If you need an edge trigger rather than level trigger, do something like this - assuming that variable 'buttons' holds the state of the joystick(s) buttons, and 'old_buttons' keeps track of the previous state of the buttons:
Code:
if(buttons!=old_buttons)
{
if((buttons&0x1)==0) /* example - bit 0 is the button to react to */
{
do_something_here(); /* execute once per button push */
}
}
old_buttons=buttons;