[][src]Function libeyelink_sys::getkey

pub unsafe extern "C" fn getkey() -> UINT16

EYELINK tracker (MS-DOS) key scan equivalent Processes Windows messages, records key events Returns 0 if no key pressed returns 1-255 for non-extended keys returns 0x##00 for extended keys (##=hex code) A routine for checking for Windows keystroke events, and dispatching Windows messages. If no key is pressed or waiting, it returns \c 0. For a standard ASCII key, a value from \c 31 to \c 127 is returned. For extended keys, a special key value is returned. If the program has been terminated by ALT-F4 or a call to \c terminal_break(), or the "Ctrl" and "C" keys are held down, the value \c TERMINATE_KEY is returned. The value JUNK_KEY (1) is returned if a non-translatable key is pressed. @remarks Warning: This function processes and dispatches any waiting messages. This will allow Windows to perform disk access and negates the purpose of realtime mode. Usually these delays will be only a few milliseconds, but delays over 20 milliseconds have been observed. You may wish to call \c escape_pressed() or \c break_pressed() in recording loops instead of \c getkey() if timing is critical, for example in a gaze-contingent display. Under Windows XP and later, for single core system, these calls will not work in realtime mode at all (although these do work under Windows 2000). Under Windows 95/98/Me, realtime performance is impossible even with this strategy.\n Some useful keys are defined in core_expt.h, as:\n \arg \c CURS_UP \c 0x4800 \arg \c CURS_DOWN \c 0x5000 \arg \c CURS_LEFT \c 0x4B00 \arg \c CURS_RIGHT \c 0x4D00 \arg \c ESC_KEY \c 0x001B \arg \c ENTER_KEY \c 0x000D \arg \c TERMINATE_KEY \c 0x7FFF \arg \c JUNK_KEY \c 0x0001 @return \c 0 if no key pressed, else key code.\n \c TERMINATE_KEY if CTRL-C held down or program has been terminated.

\b Example:

\code

#include 
UINT32  delay_time = 5000L;  // Set the maximum wait time

eyelink_flush_keybuttons(0);

delay_time += current_msec();
while(1)
{
if(current_time() > delay_time)
{
eyemsg_printf("WAITKEY TIMEOUT");
break;
}
key = getkey();
if(key) // If key press occurs
{
if(key < 256 && isprint(key))
eyemsg_printf("WAITKEY '%c'", key);
else
eyemsg_printf("WAITKEY 0x%04X", key);
break;
}
}
\endcode

\sa \c break_pressed(), \c echo_key(), \c escape_pressed(), \c eyelink_flush_keybuttons() and \c eyelink_send_keybutton()