Definition
bool IsKeyDown(string DirectInputKeyCode)
Description
This function determines whether the key DirectInputKeyCode is down or not.
Return Value
If key DirectInputKeyCode is down, it returns true, otherwise it returns false. Accepted string are:
string Meaning
“DIK_ESCAPE” Esc
“DIK_1” 1
“DIK_2” 2
“DIK_3” 3
“DIK_4” 4
“DIK_5” 5
“DIK_6” 6
“DIK_7” 7
“DIK_8” 8
“DIK_9” 9
“DIK_0” 0
“DIK_MINUS” –
“DIK_EQUALS” =
“DIK_BACK” Back Space
“DIK_TAB” Tab
“DIK_Q” Q
“DIK_W” W
“DIK_E” E
“DIK_R” R
“DIK_T” T
“DIK_Y” Y
“DIK_U” U
“DIK_I” I
“DIK_O” O
“DIK_P” P
“DIK_LBRACKET” [
“DIK_RBRACKET” ]
“DIK_RETURN” Enter
“DIK_LCONTROL” Ctrl (Left)
“DIK_A” A
“DIK_S” S
“DIK_D” D
“DIK_F” F
“DIK_G” G
“DIK_H” H
“DIK_J” J
“DIK_K” K
“DIK_L” L
“DIK_SEMICOLON” ;
“DIK_APOSTROPHE” ‘
“DIK_GRAVE” `
“DIK_LSHIFT” Shift (Left)
“DIK_BACKSLASH” \
“DIK_Z” Z
“DIK_X” X
“DIK_C” C
“DIK_V” V
“DIK_B” B
“DIK_N” N
“DIK_M” M
“DIK_COMMA” ,
“DIK_PERIOD” .
“DIK_SLASH” /
“DIK_RSHIFT” Shift (Right)
“DIK_MULTIPLY” * (Numpad)
“DIK_LMENU” Alt (Left)
“DIK_SPACE” Space
“DIK_CAPITAL” Caps Lock
“DIK_F1” F1
“DIK_F2” F2
“DIK_F3” F3
“DIK_F4” F4
“DIK_F5” F5
“DIK_F6” F6
“DIK_F7” F7
“DIK_F8” F8
“DIK_F9” F9
“DIK_F10” F10
“DIK_NUMLOCK” Num Lock
“DIK_SCROLL” Scroll Lock
“DIK_NUMPAD7” 7 (Numpad)
“DIK_NUMPAD8” 8 (Numpad)
“DIK_NUMPAD9” 9 (Numpad)
“DIK_SUBTRACT” – (Numpad)
“DIK_NUMPAD4” 4 (Numpad)
“DIK_NUMPAD5” 5 (Numpad)
“DIK_NUMPAD6” 6 (Numpad)
“DIK_ADD” + (Numpad)
“DIK_NUMPAD1” 1 (Numpad)
“DIK_NUMPAD2” 2 (Numpad)
“DIK_NUMPAD3” 3 (Numpad)
“DIK_NUMPAD0” 0 (Numpad)
“DIK_DECIMAL” . (Numpad)
“DIK_F11” F11
“DIK_F12” F12
“DIK_F13” F13 NEC PC-98
“DIK_F14” F14 NEC PC-98
“DIK_F15” F15 NEC PC-98
“DIK_KANA” Kana Japenese Keyboard
“DIK_CONVERT” Convert Japenese Keyboard
“DIK_NOCONVERT” No Convert Japenese Keyboard
“DIK_YEN” ¥ Japenese Keyboard
“DIK_NUMPADEQUALS” = NEC PC-98
“DIK_CIRCUMFLEX” ^ Japenese Keyboard
“DIK_AT” @ NEC PC-98
“DIK_COLON” : NEC PC-98
“DIK_UNDERLINE” _ NEC PC-98
“DIK_KANJI” Kanji Japenese Keyboard
“DIK_STOP” Stop NEC PC-98
“DIK_AX” (Japan AX)
“DIK_UNLABELED” (J3100)
“DIK_NUMPADENTER” Enter (Numpad)
“DIK_RCONTROL” Ctrl (Right)
“DIK_NUMPADCOMMA” , (Numpad) NEC PC-98
“DIK_DIVIDE” / (Numpad)
“DIK_SYSRQ” Sys Rq
“DIK_RMENU” Alt (Right)
“DIK_PAUSE” Pause
“DIK_HOME” Home
“DIK_UP” ↑
“DIK_PRIOR” Page Up
“DIK_LEFT” ←
“DIK_RIGHT” →
“DIK_END” End
“DIK_DOWN” ↓
“DIK_NEXT” Page Down
“DIK_INSERT” Insert
“DIK_DELETE” Delete
“DIK_LWIN” Windows
“DIK_RWIN” Windows
“DIK_APPS” Menu
“DIK_POWER” Power
“DIK_SLEEP” Windows
Example
AkeyDown = false function Init() end function Update() AkeyDown = IsKeyDown("DIK_A") if AkeyDown then PrintConsole("\nA key is down") end endIsKeyDown