Document keyboard ghosting caveats in Input and InputEvent
This also adds recommendations for choosing between `is_physical_key_pressed()` and `is_key_pressed()`.
This commit is contained in:
parent
e45a1c05dc
commit
d01e22f187
2 changed files with 8 additions and 0 deletions
|
@ -187,6 +187,7 @@
|
|||
Returns [code]true[/code] when the user starts pressing the action event, meaning it's [code]true[/code] only on the frame that the user pressed down the button.
|
||||
This is useful for code that needs to run only once when an action is pressed, instead of every frame while it's pressed.
|
||||
If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events.
|
||||
[b]Note:[/b] Due to keyboard ghosting, [method is_action_just_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_action_just_released" qualifiers="const">
|
||||
|
@ -205,6 +206,7 @@
|
|||
<description>
|
||||
Returns [code]true[/code] if you are pressing the action event. Note that if an action has multiple buttons assigned and more than one of them is pressed, releasing one button will release the action, even if some other button assigned to this action is still pressed.
|
||||
If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events.
|
||||
[b]Note:[/b] Due to keyboard ghosting, [method is_action_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_joy_button_pressed" qualifiers="const">
|
||||
|
@ -227,6 +229,8 @@
|
|||
<argument index="0" name="keycode" type="int" enum="Key" />
|
||||
<description>
|
||||
Returns [code]true[/code] if you are pressing the key in the current keyboard layout. You can pass a [enum Key] constant.
|
||||
[method is_key_pressed] is only recommended over [method is_physical_key_pressed] in non-game applications. This ensures that shortcut keys behave as expected depending on the user's keyboard layout, as keyboard shortcuts are generally dependent on the keyboard layout in non-game applications. If in doubt, use [method is_physical_key_pressed].
|
||||
[b]Note:[/b] Due to keyboard ghosting, [method is_key_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_mouse_button_pressed" qualifiers="const">
|
||||
|
@ -241,6 +245,8 @@
|
|||
<argument index="0" name="keycode" type="int" enum="Key" />
|
||||
<description>
|
||||
Returns [code]true[/code] if you are pressing the key in the physical location on the 101/102-key US QWERTY keyboard. You can pass a [enum Key] constant.
|
||||
[method is_physical_key_pressed] is recommended over [method is_key_pressed] for in-game actions, as it will make [kbd]W[/kbd]/[kbd]A[/kbd]/[kbd]S[/kbd]/[kbd]D[/kbd] layouts work regardless of the user's keyboard layout. [method is_physical_key_pressed] will also ensure that the top row number keys work on any keyboard layout. If in doubt, use [method is_physical_key_pressed].
|
||||
[b]Note:[/b] Due to keyboard ghosting, [method is_physical_key_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information.
|
||||
</description>
|
||||
</method>
|
||||
<method name="parse_input_event">
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
<description>
|
||||
Returns [code]true[/code] if the given action is being pressed (and is not an echo event for [InputEventKey] events, unless [code]allow_echo[/code] is [code]true[/code]). Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag].
|
||||
If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events.
|
||||
[b]Note:[/b] Due to keyboard ghosting, [method is_action_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_action_released" qualifiers="const">
|
||||
|
@ -89,6 +90,7 @@
|
|||
<return type="bool" />
|
||||
<description>
|
||||
Returns [code]true[/code] if this input event is pressed. Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag].
|
||||
[b]Note:[/b] Due to keyboard ghosting, [method is_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information.
|
||||
</description>
|
||||
</method>
|
||||
<method name="xformed_by" qualifiers="const">
|
||||
|
|
Loading…
Reference in a new issue