Scancode
Available since LÖVE 0.9.2
This enum is not supported in earlier versions.
Keyboard scancodes.
Scancodes are keyboard layout-independent, so the scancode "w" will be generated if the key in the same place as the "w" key on an American QWERTY keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.
Using scancodes, rather than keycodes, is useful because keyboards with layouts differing from the US/UK layout(s) might have keys that generate 'unknown' keycodes, but the scancodes will still be detected. This however would necessitate having a list for each keyboard layout one would choose to support.
One could use textinput or textedited instead, but those only give back the end result of keys used, i.e. you can't get modifiers on their own from it, only the final symbols that were generated.
Constants
- a
- The 'A' key on an American layout.
- b
- The 'B' key on an American layout.
- c
- The 'C' key on an American layout.
- d
- The 'D' key on an American layout.
- e
- The 'E' key on an American layout.
- f
- The 'F' key on an American layout.
- g
- The 'G' key on an American layout.
- h
- The 'H' key on an American layout.
- i
- The 'I' key on an American layout.
- j
- The 'J' key on an American layout.
- k
- The 'K' key on an American layout.
- l
- The 'L' key on an American layout.
- m
- The 'M' key on an American layout.
- n
- The 'N' key on an American layout.
- o
- The 'O' key on an American layout.
- p
- The 'P' key on an American layout.
- q
- The 'Q' key on an American layout.
- r
- The 'R' key on an American layout.
- s
- The 'S' key on an American layout.
- t
- The 'T' key on an American layout.
- u
- The 'U' key on an American layout.
- v
- The 'V' key on an American layout.
- w
- The 'W' key on an American layout.
- x
- The 'X' key on an American layout.
- y
- The 'Y' key on an American layout.
- z
- The 'Z' key on an American layout.
- 1
- The '1' key on an American layout.
- 2
- The '2' key on an American layout.
- 3
- The '3' key on an American layout.
- 4
- The '4' key on an American layout.
- 5
- The '5' key on an American layout.
- 6
- The '6' key on an American layout.
- 7
- The '7' key on an American layout.
- 8
- The '8' key on an American layout.
- 9
- The '9' key on an American layout.
- 0
- The '0' key on an American layout.
- return
- The 'return' / 'enter' key on an American layout.
- escape
- The 'escape' key on an American layout.
- backspace
- The 'backspace' key on an American layout.
- tab
- The 'tab' key on an American layout.
- space
- The spacebar on an American layout.
- -
- The minus key on an American layout.
- =
- The equals key on an American layout.
- [
- The left-bracket key on an American layout.
- ]
- The right-bracket key on an American layout.
- \
- The backslash key on an American layout.
- nonus#
- The non-U.S. hash scancode.
- ;
- The semicolon key on an American layout.
- '
- The apostrophe key on an American layout.
- `
- The back-tick / grave key on an American layout.
- ,
- The comma key on an American layout.
- .
- The period key on an American layout.
- /
- The forward-slash key on an American layout.
- capslock
- The capslock key on an American layout.
- f1
- The F1 key on an American layout.
- f2
- The F2 key on an American layout.
- f3
- The F3 key on an American layout.
- f4
- The F4 key on an American layout.
- f5
- The F5 key on an American layout.
- f6
- The F6 key on an American layout.
- f7
- The F7 key on an American layout.
- f8
- The F8 key on an American layout.
- f9
- The F9 key on an American layout.
- f10
- The F10 key on an American layout.
- f11
- The F11 key on an American layout.
- f12
- The F12 key on an American layout.
- f13
- The F13 key on an American layout.
- f14
- The F14 key on an American layout.
- f15
- The F15 key on an American layout.
- f16
- The F16 key on an American layout.
- f17
- The F17 key on an American layout.
- f18
- The F18 key on an American layout.
- f19
- The F19 key on an American layout.
- f20
- The F20 key on an American layout.
- f21
- The F21 key on an American layout.
- f22
- The F22 key on an American layout.
- f23
- The F23 key on an American layout.
- f24
- The F24 key on an American layout.
- lctrl
- The left control key on an American layout.
- lshift
- The left shift key on an American layout.
- lalt
- The left alt / option key on an American layout.
- lgui
- The left GUI (command / windows / super) key on an American layout.
- rctrl
- The right control key on an American layout.
- rshift
- The right shift key on an American layout.
- ralt
- The right alt / option key on an American layout.
- rgui
- The right GUI (command / windows / super) key on an American layout.
- printscreen
- The printscreen key on an American layout.
- scrolllock
- The scroll-lock key on an American layout.
- pause
- The pause key on an American layout.
- insert
- The insert key on an American layout.
- home
- The home key on an American layout.
- numlock
- The numlock / clear key on an American layout.
- pageup
- The page-up key on an American layout.
- delete
- The forward-delete key on an American layout.
- end
- The end key on an American layout.
- pagedown
- The page-down key on an American layout.
- right
- The right-arrow key on an American layout.
- left
- The left-arrow key on an American layout.
- down
- The down-arrow key on an American layout.
- up
- The up-arrow key on an American layout.
- nonusbackslash
- The non-U.S. backslash scancode.
- application
- The application key on an American layout. Windows contextual menu, compose key.
- execute
- The 'execute' key on an American layout.
- help
- The 'help' key on an American layout.
- menu
- The 'menu' key on an American layout.
- select
- The 'select' key on an American layout.
- stop
- The 'stop' key on an American layout.
- again
- The 'again' key on an American layout.
- undo
- The 'undo' key on an American layout.
- cut
- The 'cut' key on an American layout.
- copy
- The 'copy' key on an American layout.
- paste
- The 'paste' key on an American layout.
- find
- The 'find' key on an American layout.
Keypad scancodes
- kp/
- The keypad forward-slash key on an American layout.
- kp*
- The keypad '*' key on an American layout.
- kp-
- The keypad minus key on an American layout.
- kp+
- The keypad plus key on an American layout.
- kp=
- The keypad equals key on an American layout.
- kpenter
- The keypad enter key on an American layout.
- kp1
- The keypad '1' key on an American layout.
- kp2
- The keypad '2' key on an American layout.
- kp3
- The keypad '3' key on an American layout.
- kp4
- The keypad '4' key on an American layout.
- kp5
- The keypad '5' key on an American layout.
- kp6
- The keypad '6' key on an American layout.
- kp7
- The keypad '7' key on an American layout.
- kp8
- The keypad '8' key on an American layout.
- kp9
- The keypad '9' key on an American layout.
- kp0
- The keypad '0' key on an American layout.
- kp.
- The keypad period key on an American layout.
International / language scancodes
- international1
- The 1st international key on an American layout. Used on Asian keyboards.
- international2
- The 2nd international key on an American layout.
- international3
- The 3rd international key on an American layout. Yen.
- international4
- The 4th international key on an American layout.
- international5
- The 5th international key on an American layout.
- international6
- The 6th international key on an American layout.
- international7
- The 7th international key on an American layout.
- international8
- The 8th international key on an American layout.
- international9
- The 9th international key on an American layout.
- lang1
- Hangul/English toggle scancode.
- lang2
- Hanja conversion scancode.
- lang3
- Katakana scancode.
- lang4
- Hiragana scancode.
- lang5
- Zenkaku/Hankaku scancode.
- mute
- The mute key on an American layout.
- volumeup
- The volume up key on an American layout.
- volumedown
- The volume down key on an American layout.
- audionext
- The audio next track key on an American layout.
- audioprev
- The audio previous track key on an American layout.
- audiostop
- The audio stop key on an American layout.
- audioplay
- The audio play key on an American layout.
- audiomute
- The audio mute key on an American layout.
- mediaselect
- The media select key on an American layout.
- www
- The 'WWW' key on an American layout.
- mail
- The Mail key on an American layout.
- calculator
- The calculator key on an American layout.
- computer
- The 'computer' key on an American layout.
- acsearch
- The AC Search key on an American layout.
- achome
- The AC Home key on an American layout.
- acback
- The AC Back key on an American layout.
- acforward
- The AC Forward key on an American layout.
- acstop
- Th AC Stop key on an American layout.
- acrefresh
- The AC Refresh key on an American layout.
- acbookmarks
- The AC Bookmarks key on an American layout.
Hardware setting scancodes
- power
- The system power scancode.
- brightnessdown
- The brightness-down scancode.
- brightnessup
- The brightness-up scancode.
- displayswitch
- The display switch scancode.
- kbdillumtoggle
- The keyboard illumination toggle scancode.
- kbdillumdown
- The keyboard illumination down scancode.
- kbdillumup
- The keyboard illumination up scancode.
- eject
- The eject scancode.
- sleep
- The system sleep scancode.
Misc.
- alterase
- The alt-erase key on an American layout.
- sysreq
- The sysreq key on an American layout.
- cancel
- The 'cancel' key on an American layout.
- clear
- The 'clear' key on an American layout.
- prior
- The 'prior' key on an American layout.
- return2
- The 'return2' key on an American layout.
- separator
- The 'separator' key on an American layout.
- out
- The 'out' key on an American layout.
- oper
- The 'oper' key on an American layout.
- clearagain
- The 'clearagain' key on an American layout.
- crsel
- The 'crsel' key on an American layout.
- exsel
- The 'exsel' key on an American layout.
- kp00
- The keypad 00 key on an American layout.
- kp000
- The keypad 000 key on an American layout.
- thsousandsseparator
- The thousands-separator key on an American layout.
- decimalseparator
- The decimal separator key on an American layout.
- currencyunit
- The currency unit key on an American layout.
- currencysubunit
- The currency sub-unit key on an American layout.
- app1
- The 'app1' scancode.
- app2
- The 'app2' scancode.
- unknown
- An unknown key.
See Also