Difference between revisions of "love.keyboard.getScancodeFromKey"

(Created page)
 
m
Line 6: Line 6:
 
For example, pressing the key located where "q" is on a U.S. keyboard will produce the key "q" and the scancode "q" when using a U.S. keyboard layout, but when using a French keyboard layout it will produce the key "a" and the scancode "q".
 
For example, pressing the key located where "q" is on a U.S. keyboard will produce the key "q" and the scancode "q" when using a U.S. keyboard layout, but when using a French keyboard layout it will produce the key "a" and the scancode "q".
  
Scancodes are useful for creating default controls that have the same physical locations on on all keyboards.
+
Scancodes are useful for creating default controls that have the same physical locations on on all keyboards and systems.
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===

Revision as of 04:00, 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, pressing the key located where "q" is on a U.S. keyboard will produce the key "q" and the scancode "q" when using a U.S. keyboard layout, but when using a French keyboard layout it will produce the key "a" and the scancode "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.

See Also

Other Languages