[][src]Function libeyelink_sys::eyelink_last_button_press

pub unsafe extern "C" fn eyelink_last_button_press(time: *mut UINT32) -> UINT16

@ingroup elbutton Reads the number of the last button detected by the EyeLink tracker. This is \c 0 if no buttons were pressed since the last call, or since the buttons were flushed. If a pointer to a variable is supplied the eye-tracker timestamp of the button may be read. This could be used to see if a new button has been pressed since the last read. If multiple buttons were pressed since the last call, only the last button is reported.

@param time Far pointer to a variable to hold tracker time of last button press. Usually left as \c NULL to ignore time. @return Button last pressed, \c 0 if no button pressed since last read, or call to \c eyelink_flush_keybuttons().

\b Example:

\code

#include 
int   button;

eyelink_flush_keybuttons(0);

while(1)
{
button = eyelink_last_button_press(NULL);

if(button != 0 && button != 6 && button != 7)
{
if (button == 5)
{
eyemsg_printf("ENDBUTTON %d", button);
break;
}
else
eyemsg_printf("BUTTON PRESSED %d", button);
}
}
\endcode

\b Output:

\code
BUTTON	19753748	2	1
MSG	19753749 BUTTON PRESSED 2
BUTTON	19754018	2	0
BUTTON	19755595	5	1
MSG	19755595 ENDBUTTON 5
BUTTON	19755808	5	0
\endcode

\sa \c eyelink_flush_keybuttons(), \c eyelink_button_states(), \c eyelink_read_keybutton() and \c eyelink_send_keybutton()