summaryrefslogtreecommitdiffstats
path: root/doc/classes
diff options
context:
space:
mode:
authorFredia Huya-Kouadio <fhuya@meta.com>2023-05-03 17:57:13 -0700
committerFredia Huya-Kouadio <fhuya@meta.com>2023-05-15 11:48:25 -0700
commit250749fa7956b450fff8446d5f361874743389ca (patch)
tree8df57a1a91e2fb51e3416c288cb35a2387d8b0a5 /doc/classes
parentcf8ad12b56df4ae7bba4c73070dd035693a880e4 (diff)
downloadredot-engine-250749fa7956b450fff8446d5f361874743389ca.tar.gz
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.
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/InputEvent.xml12
-rw-r--r--doc/classes/InputEventMouseButton.xml3
-rw-r--r--doc/classes/InputEventScreenTouch.xml3
3 files changed, 18 insertions, 0 deletions
diff --git a/doc/classes/InputEvent.xml b/doc/classes/InputEvent.xml
index 9e2e115301..5d2dc8942f 100644
--- a/doc/classes/InputEvent.xml
+++ b/doc/classes/InputEvent.xml
@@ -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>
@@ -93,6 +99,12 @@
[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="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="xformed_by" qualifiers="const">
<return type="InputEvent" />
<param index="0" name="xform" type="Transform2D" />
diff --git a/doc/classes/InputEventMouseButton.xml b/doc/classes/InputEventMouseButton.xml
index ebed234f2f..500244f209 100644
--- a/doc/classes/InputEventMouseButton.xml
+++ b/doc/classes/InputEventMouseButton.xml
@@ -13,6 +13,9 @@
<member name="button_index" type="int" setter="set_button_index" getter="get_button_index" enum="MouseButton" default="0">
The mouse button identifier, one of the [enum MouseButton] button or button wheel constants.
</member>
+ <member name="canceled" type="bool" setter="set_canceled" getter="is_canceled" default="false">
+ If [code]true[/code], the mouse button event has been canceled.
+ </member>
<member name="double_click" type="bool" setter="set_double_click" getter="is_double_click" default="false">
If [code]true[/code], the mouse button's state is a double-click.
</member>
diff --git a/doc/classes/InputEventScreenTouch.xml b/doc/classes/InputEventScreenTouch.xml
index d7230a6814..2f993d151c 100644
--- a/doc/classes/InputEventScreenTouch.xml
+++ b/doc/classes/InputEventScreenTouch.xml
@@ -11,6 +11,9 @@
<link title="InputEvent">$DOCS_URL/tutorials/inputs/inputevent.html</link>
</tutorials>
<members>
+ <member name="canceled" type="bool" setter="set_canceled" getter="is_canceled" default="false">
+ If [code]true[/code], the touch event has been canceled.
+ </member>
<member name="double_tap" type="bool" setter="set_double_tap" getter="is_double_tap" default="false">
If [code]true[/code], the touch's state is a double tap.
</member>