NAME
====
vg_key_pressed() - check whether a key is pressed
SYNOPSIS
========
int vg_key_pressed(int key, int type)
DESCRIPTION
===========
Check a certain key with this function
to figure out whether it is pressed or not.
The key argument is a "KEY_*" of the list below, which indicates
the key to be checked.
The type argument is:
- LONGKEY: return "pressed" while you press the key
- SHORTKEY: return "pressed" only the first time you press it
(then you have to release the key and press it again)
Example
You press the key "A" and keep it pressed
call to vg_key_pressed(KEY_A,LONGKEY) returns 1 (pressed)
call to vg_key_pressed(KEY_A,LONGKEY) again returns 1 (pressed)
call to vg_key_pressed(KEY_A,SHORTKEY) returns 1 (pressed)
call to vg_key_pressed(KEY_A,SHORTKEY) returns 0 (not pressed)
You release the key "A"
call to vg_key_pressed(KEY_A,LONGKEY) returns 0 (not pressed)
call to vg_key_pressed(KEY_A,SHORTKEY) returns 0 (not pressed)
LIST OF KEYS
============
==>
KEY_0 "0"
KEY_1 "1"
KEY_2 "2"
KEY_3 "3"
KEY_4 "4"
KEY_5 "5"
KEY_6 "6"
KEY_7 "7"
KEY_8 "8"
KEY_9 "9"
KEY_A "A"
KEY_B "B"
KEY_C "C"
KEY_D "D"
KEY_E "E"
KEY_F "F"
KEY_G "G"
KEY_H "H"
KEY_I "I"
KEY_J "J"
KEY_K "K"
KEY_L "L"
KEY_M "M"
KEY_N "N"
KEY_O "O"
KEY_P "P"
KEY_Q "Q"
KEY_R "R"
KEY_S "S"
KEY_T "T"
KEY_U "U"
KEY_V "V"
KEY_W "W"
KEY_X "X"
KEY_Y "Y"
KEY_Z "Z"
KEY_KP_0 Keypad 0
KEY_KP_1 Keypad 1
KEY_KP_2 Keypad 2
KEY_KP_3 Keypad 3
KEY_KP_4 Keypad 4
KEY_KP_5 Keypad 5
KEY_KP_6 Keypad 6
KEY_KP_7 Keypad 7
KEY_KP_8 Keypad 8
KEY_KP_9 Keypad 9
KEY_TAB Tabulator
KEY_RCTRL Right Control
KEY_LCTRL Left Control
KEY_RALT Right Alt
KEY_LALT Left Alt
KEY_SPACE Space
KEY_ENTER Return
KEY_BSP Backspace
KEY_RCURS Right Cursor
KEY_LCURS Left Cursor
KEY_UCURS Up Cursor
KEY_DCURS Down Cursor
KEY_F1 F1
KEY_F2 F2
KEY_F3 F3
KEY_F4 F4
KEY_F5 F5
KEY_F6 F6
KEY_F7 F7
KEY_F8 F8
KEY_F9 F9
KEY_F10 F10
KEY_F11 F11
KEY_F12 F12
|
<==
RETURN VALUE
============
If the key is pressed, it returns 1,
if the key is not pressed, it returns 0.
SEE ALSO
========
Index
Understanding window and key
vg_key_discard()
vg_key_update()
vg_mouse_found()
vg_mouse_x()
vg_mouse_y()
vg_mouse_pressed()
vg_mouse_speed()