Difference between revisions of "love.keyboard.getScancodeFromKey"
m |
m |
||
Line 4: | Line 4: | ||
The location of a [[KeyConstant|key]] is based on the keyboard's current language layout, whereas [[Scancode|scancodes]] are the layout-independent representations of where the physical keys are. | The location of a [[KeyConstant|key]] is based on the keyboard's current language layout, whereas [[Scancode|scancodes]] are the layout-independent representations of where the physical keys are. | ||
− | For example, | + | For example, the key located where "q" is on a U.S. keyboard has the scancode "q". When using a U.S. keyboard layout it produces the key "q", but when using a French keyboard layout it produces the key "a". French keyboards usually label the key as "a" rather than "q". |
Scancodes are useful for creating default controls that have the same physical locations on on all keyboards and systems. | Scancodes are useful for creating default controls that have the same physical locations on on all keyboards and systems. | ||
Line 15: | Line 15: | ||
{{param|KeyConstant|key|The key to get the scancode from.}} | {{param|KeyConstant|key|The key to get the scancode from.}} | ||
=== Returns === | === Returns === | ||
− | {{param|Scancode|scancode|The scancode corresponding to the given key.}} | + | {{param|Scancode|scancode|The scancode corresponding to the given key, or "unknown" if the given key has no known physical representation on the current system.}} |
== See Also == | == See Also == | ||
* [[parent::love.keyboard]] | * [[parent::love.keyboard]] |
Revision as of 03:08, 9 February 2015
Available since LÖVE 0.9.2 |
This function is not supported in earlier versions. |
Gets the hardware scancode corresponding to the given key.
The location of a key is based on the keyboard's current language layout, whereas scancodes are the layout-independent representations of where the physical keys are.
For example, the key located where "q" is on a U.S. keyboard has the scancode "q". When using a U.S. keyboard layout it produces the key "q", but when using a French keyboard layout it produces the key "a". French keyboards usually label the key as "a" rather than "q".
Scancodes are useful for creating default controls that have the same physical locations on on all keyboards and systems.
Function
Synopsis
scancode = love.keyboard.getScancodeFromKey( key )
Arguments
KeyConstant key
- The key to get the scancode from.
Returns
Scancode scancode
- The scancode corresponding to the given key, or "unknown" if the given key has no known physical representation on the current system.
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info