Macros | |
#define | CURS_UP 0x4800 |
#define | CURS_DOWN 0x5000 |
#define | CURS_LEFT 0x4B00 |
#define | CURS_RIGHT 0x4D00 |
#define | ESC_KEY 0x001B |
#define | ENTER_KEY 0x000D |
#define | PAGE_UP 0x4900 |
#define | PAGE_DOWN 0x5100 |
#define | JUNK_KEY 1 |
#define | TERMINATE_KEY 0x7FFF |
Functions | |
void | flush_getkey_queue (void) |
UINT16 | read_getkey_queue (void) |
UINT16 | echo_key (void) |
UINT16 | getkey (void) |
UINT32 | getkey_with_mod (UINT16 *unicode) |
INT16 | escape_pressed (void) |
INT16 | break_pressed (void) |
void | terminal_break (INT16 assert) |
#define CURS_DOWN 0x5000 |
Cursor down key.
#define CURS_LEFT 0x4B00 |
Cursor left key.
#define CURS_RIGHT 0x4D00 |
Cursor right key.
#define CURS_UP 0x4800 |
Cursor up key.
#define ENTER_KEY 0x000D |
Return key.
#define ESC_KEY 0x001B |
Escape key.
#define JUNK_KEY 1 |
Junk key to indicate untranslatable key.
#define PAGE_DOWN 0x5100 |
Page down key.
#define PAGE_UP 0x4900 |
Page up key.
#define TERMINATE_KEY 0x7FFF |
Returned by getkey if program should exit.
INT16 break_pressed | ( | void | ) |
Tests if the program is being interrupted. You should break out of loops immediately if this function does not return 0
, if getkey()
return TERMINATE_KEY
, or if eyelink_is_connected()
returns 0
.
1
if CTRL-C is pressed, terminal_break()
was called, or the program has been terminated with ALT-F4; 0
otherwise.Example:
echo_key()
, escape_pressed()
and getkey()
UINT16 echo_key | ( | void | ) |
Checks for Windows keystroke events and dispatches messages; similar to getkey()
, but also sends keystroke to tracker.
0
if no key pressed, else key code.TERMINATE_KEY
if CTRL-C held down or program has been terminated.Example:
eyelink_read_keybutton()
, eyelink_send_keybutton()
and getkey()
INT16 escape_pressed | ( | void | ) |
This function tests if the 'ESC' key is held down, and is usually used to break out of nested loops. This does not allow processing of Windows messages, unlike getkey()
.
1
if 'ESC' key held down; 0
if not.Example: See break_pressed()
break_pressed()
, getkey()
and echo_key()
void flush_getkey_queue | ( | void | ) |
Initializes the key queue used by getkey()
. This should be called at the start of your program. It may be called at any time to get rid any of old keys from the queue.
Example:
read_getkey_queue()
UINT16 getkey | ( | void | ) |
A routine for checking for Windows keystroke events, and dispatching Windows messages. If no key is pressed or waiting, it returns 0
. For a standard ASCII key, a value from 31
to 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 terminal_break()
, or the "Ctrl" and "C" keys are held down, the value TERMINATE_KEY
is returned. The value JUNK_KEY (1)
is returned if a non-translatable key is pressed.
escape_pressed()
or break_pressed()
in recording loops instead of getkey()
if timing is critical, for example in a gaze-contingent display. Some useful keys are defined in core_expt.h, as:CURS_UP
0x4800
CURS_DOWN
0x5000
CURS_LEFT
0x4B00
CURS_RIGHT
0x4D00
ESC_KEY
0x001B
ENTER_KEY
0x000D
TERMINATE_KEY
0x7FFF
JUNK_KEY
0x0001
0
if no key pressed, else key code.TERMINATE_KEY
if CTRL-C held down or program has been terminated.Example:
UINT32 getkey_with_mod | ( | UINT16 * | unicode | ) |
Same as getkey except it returns the modifier and the key pressed. It returns a 32 bit unsigned integer. The first 16 bits are reserved for the modifier and the last 16 bits are reserved for the key values. If there are no modifiers present, the return value of this is the same as getkey(). If non null pointer passed in for unicode, the translated key value will be set if a key is preent.
UINT16 read_getkey_queue | ( | void | ) |
Reads keys from the key queue. It is similar to getkey()
, but does not process Windows messages. This can be used to build key-message handlers in languages other than C.
0
if no key pressed. JUNK_KEY (1)
if untranslatable key.TERMINATE_KEY (0x7FFF)
if CTRL-C is pressed, terminal_break()
was called, or the program has been terminated with ALT-F4.flush_getkey_queue()
void terminal_break | ( | INT16 | assert | ) |
This function can be called in an event handler to signal that the program is terminating. Calling this function with an argument of 1
will cause break_pressed()
to return 1
, and getkey()
to return TERMINATE_KEY
. These functions can be re-enabled by calling terminal_break()
with an argument of 0
.
assert | 1 to signal a program break, 0 to reset break. |
Example:
break_pressed()
and getkey()