Difference between revisions of "love.keyboard.getKeyFromScancode"
m |
m |
||
(One intermediate revision by the same user not shown) | |||
Line 2: | Line 2: | ||
Gets the key corresponding to the given hardware scancode. | Gets the key corresponding to the given hardware scancode. | ||
− | + | Unlike [[KeyConstant|key constants]], [[Scancode]]s are keyboard layout-independent. For example the scancode "w" will be generated if the key in the same place as the "w" key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are. | |
− | |||
− | For example | ||
Scancodes are useful for creating default controls that have the same physical locations on on all systems. | Scancodes are useful for creating default controls that have the same physical locations on on all systems. | ||
Line 15: | Line 13: | ||
{{param|Scancode|scancode|The scancode to get the key from.}} | {{param|Scancode|scancode|The scancode to get the key from.}} | ||
=== Returns === | === Returns === | ||
− | {{param|KeyConstant|key|The key corresponding to the given scancode, or "unknown" if the scancode doesn't map to a | + | {{param|KeyConstant|key|The key corresponding to the given scancode, or "unknown" if the scancode doesn't map to a [[KeyConstant]] on the current system.}} |
== See Also == | == See Also == | ||
* [[parent::love.keyboard]] | * [[parent::love.keyboard]] | ||
* [[love.keyboard.getScancodeFromKey]] | * [[love.keyboard.getScancodeFromKey]] | ||
+ | * [[love.keyboard.isScancodeDown]] | ||
+ | * [[love.keypressed]] | ||
+ | * [[love.keyreleased]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
{{#set:Description=Gets the key corresponding to the given hardware scancode.}} | {{#set:Description=Gets the key corresponding to the given hardware scancode.}} | ||
== Other Languages == | == Other Languages == | ||
{{i18n|love.keyboard.getKeyFromScancode}} | {{i18n|love.keyboard.getKeyFromScancode}} |
Latest revision as of 04:57, 18 December 2015
Available since LÖVE 0.9.2 |
This function is not supported in earlier versions. |
Gets the key corresponding to the given hardware scancode.
Unlike key constants, Scancodes are keyboard layout-independent. For example the scancode "w" will be generated if the key in the same place as the "w" key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.
Scancodes are useful for creating default controls that have the same physical locations on on all systems.
Function
Synopsis
key = love.keyboard.getKeyFromScancode( scancode )
Arguments
Scancode scancode
- The scancode to get the key from.
Returns
KeyConstant key
- The key corresponding to the given scancode, or "unknown" if the scancode doesn't map to a KeyConstant on the current system.
See Also
- love.keyboard
- love.keyboard.getScancodeFromKey
- love.keyboard.isScancodeDown
- love.keypressed
- love.keyreleased
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