-
Notifications
You must be signed in to change notification settings - Fork 3
tarn_getkey
jdp edited this page Sep 12, 2010
·
8 revisions
tarn_getkey()
The tarn_getkey()
function waits for a key press, and then returns a table with the keys corresponding exactly to the Doryen Library’s TCOD_key_t type. For completeness’ sake, these are the keys that the table will return:
vk | The virtual keycode representing the keystroke |
c | If they keypress is a printable character, this contains it. Otherwise it is 0 |
lalt | If the left alt is pressed, this is 1. Otherwise it is 0 |
ralt | If the right alt is pressed, this is 1. Otherwise it is 0 |
lctrl | If the left control key is pressed, this is 1. Otherwise it is 0 |
rctrl | If the right control key is pressed, this is 1. Otherwise it is 0 |
shift | If shift is pressed, this is 1. Otherwise it is 0 |
-- wait for a keypress kp = tarn_keypress() -- 65 is the virtual key code for any letter if kp.vk == 65 then -- check if the character is a lowercase q if kp.c == "q" then -- exit code goes here end end