Augment the InputEvent class with a CANCELED state

The `InputEvent` class currently supports the `pressed` and `released` states, which given the binary nature, is represented by a `bool` field.
This commit introduced the `CANCELED` state, which signals that an ongoing input event has been canceled.
To represent all the states, the `InputEventState` enum is added and the `InputEvent` logic is refactored accordingly.
This commit is contained in:
Fredia Huya-Kouadio
2023-05-03 14:23:34 -07:00
parent 716fef79ef
commit 94d6c3dcc6
8 changed files with 74 additions and 65 deletions

View File

@@ -71,6 +71,12 @@
Returns [code]true[/code] if this input event's type is one that can be assigned to an input action.
</description>
</method>
<method name="is_canceled" qualifiers="const">
<return type="bool" />
<description>
Returns [code]true[/code] if this input event has been canceled.
</description>
</method>
<method name="is_echo" qualifiers="const">
<return type="bool" />
<description>
@@ -84,6 +90,12 @@
[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_released" qualifiers="const">
<return type="bool" />
<description>
Returns [code]true[/code] if this input event is released. Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag].
</description>
</method>
<method name="shortcut_match" qualifiers="const">
<return type="bool" />
<argument index="0" name="event" type="InputEvent" />