Difference between revisions of "love.keyboard.getKeyFromScancode (简体中文)"

(Created page with "{{newin|0.9.2|092|type=function}} Gets the key corresponding to the given hardware scancode. The location of a key is based on the keyboard's current lang...")
 
m (Fixed parent)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
{{newin|[[0.9.2]]|092|type=function}}
 
{{newin|[[0.9.2]]|092|type=function}}
Gets the key corresponding to the given hardware scancode.
+
获得硬件扫描码对应的按键。
  
 
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.
Line 17: Line 17:
 
{{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.}}
 
{{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]]
 
[[Category:Functions]]
 
[[Category:Functions]]

Latest revision as of 16:31, 22 December 2015

Available since LÖVE 0.9.2
This function is not supported in earlier versions.

获得硬件扫描码对应的按键。

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".

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

Other Languages