From 106199dfa783a56298a932fa13111993bdb73f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 8 Jul 2016 23:08:53 +0200 Subject: [PATCH] classref: Add docs for InputEvent* and InputMap (cherry picked from commit 69c8b583e7b7c31e9316a24f185ca99f9452d91d) --- doc/base/classes.xml | 252 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 241 insertions(+), 11 deletions(-) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 36dffb576e..b22d20b7c6 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -14638,8 +14638,10 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Default implementation of the [Input] class. + Default implementation of the [Input] class, used internally by the editor and games for default input management. @@ -14651,7 +14653,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) Built-in input event data. - Built-in input event data. InputEvent is a built-in engine datatype, given that it's passed around and used so much. Depending on it's type, the members contained can be different, so read the documentation well!. Input events can also represent actions (editable from the project settings). + Built-in input event data. InputEvent is a built-in engine datatype, given that it's passed around and used so much. Depending on its type, the members contained can be different, so read the documentation well! Input events can also represent actions (editable from the project settings). @@ -14669,6 +14671,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is being pressed (and is not an echo event for KEY events). Not relevant for the event types MOUSE_MOTION, SCREEN_DRAG and NONE. @@ -14677,20 +14680,21 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is released (i.e. not pressed). Not relevant for the event types MOUSE_MOTION, SCREEN_DRAG and NONE. - Return if this input event is an echo event (usually for key events). + Return if this input event is an echo event (only for events of type KEY, it will return false for other types). - Return if this input event is pressed (for key, mouse, joy button or screen press events). + Return if this input event is pressed. Not relevant for the event types MOUSE_MOTION, SCREEN_DRAG and NONE. @@ -14699,15 +14703,19 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Change the input event to an action event of the given name, regardless of its initial type, with the pressed status passed as argument. + Event identifier, positive integer increased at each new event. + Device identifier. + Type of event (one of the [InputEvent] constants). @@ -14730,17 +14738,22 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) Joystick button event. + Screen touch event. + Screen drag event. + Pre-defined action event (see [InputMap]). + Built-in input event type for actions. + Input event type for actions that extends the global [InputEvent] type. @@ -14749,6 +14762,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return if this input event matches a pre-defined action, i.e. always true for InputEventAction. @@ -14757,6 +14771,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is being pressed. @@ -14765,18 +14780,21 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is released (i.e. not pressed). + Return if this input event is an echo event (only for events of type KEY, i.e. always false for this type). + Return if this input event is pressed. @@ -14785,42 +14803,57 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Change the input event to an action event of the given name with the pressed status passed as argument. + Event identifier, positive integer increased at each new event. + Device identifier. + Type of event (one of the [InputEvent] constants). + Empty input event. + Key event. + Mouse motion event. + Mouse button event. + Joystick motion event. + Joystick button event. + Screen touch event. + Screen drag event. + Pre-defined action event (see [InputMap]). + Built-in input event type for joystick button events. + Input event type for joystick button events that extends the global [InputEvent] type. @@ -14829,6 +14862,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return if this input event matches a pre-defined action. @@ -14837,6 +14871,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is being pressed. @@ -14845,18 +14880,21 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is released (i.e. not pressed). + Return if this input event is an echo event (only for events of type KEY, i.e. always false for this type). + Return if this input event is pressed. @@ -14865,48 +14903,66 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Change the input event to an action event of the given name with the pressed status passed as argument. + Event identifier, positive integer increased at each new event. + Joystick button identifier, one of the JOY_BUTTON_* constants in [@Global Scope]. + Device identifier. + Pressed state of the joystick button. + Intensity of the button pressure, ranges from 0 to 1.0. + Type of event (one of the [InputEvent] constants). + Empty input event. + Key event. + Mouse motion event. + Mouse button event. + Joystick motion event. + Joystick button event. + Screen touch event. + Screen drag event. + Pre-defined action event (see [InputMap]). + Built-in input event type for joystick motion/axis events. + Input event type for joystick motion/axis events that extends the global [InputEvent] type. @@ -14923,6 +14979,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is being pressed. @@ -14931,18 +14988,21 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is released (i.e. not pressed). + Return if this input event is an echo event (only for events of type KEY, i.e. always false for this type). + Return if this input event is pressed. @@ -14951,46 +15011,63 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Change the input event to an action event of the given name with the pressed status passed as argument. + Event identifier, positive integer increased at each new event. + Joystick axis identifier, one of the JOY_AXIS_* constants in [@Global Scope]. + Device identifier. + Type of event (one of the [InputEvent] constants). + Position of the axis, ranging from -1.0 to 1.0. A value of 0 means that the axis is in its neutral position. + Empty input event. + Key event. + Mouse motion event. + Mouse button event. + Joystick motion event. + Joystick button event. + Screen touch event. + Screen drag event. + Pre-defined action event (see [InputMap]). + Built-in input event type for keyboard events. + Input event type for keyboard events that extends the global [InputEvent] type. @@ -14999,6 +15076,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return if this input event matches a pre-defined action. @@ -15007,6 +15085,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is being pressed. @@ -15015,18 +15094,21 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is released (i.e. not pressed). + Return if this input event is an echo event. + Return if this input event is pressed. @@ -15035,58 +15117,81 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Change the input event to an action event of the given name with the pressed status passed as argument. + Event identifier, positive integer increased at each new event. + State of the Alt modifier. + State of the Ctrl modifier. + Device identifier. + Echo state of the key, i.e. whether it's a repeat event or not. + State of the Meta modifier. + Pressed state of the key. + Scancode of the key, one of the KEY_* constants in [@Global Scope]. + State of the Shift modifier. + Type of event (one of the [InputEvent] constants). + Unicode identifier of the key (when relevant). + Empty input event. + Key event. + Mouse motion event. + Mouse button event. + Joystick motion event. + Joystick button event. + Screen touch event. + Screen drag event. + Pre-defined action event (see [InputMap]). + Built-in input event type for mouse button events. + Input event type for mouse button events that extends the global [InputEvent] type. @@ -15095,6 +15200,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return if this input event matches a pre-defined action. @@ -15103,6 +15209,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is being pressed. @@ -15111,18 +15218,21 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is released (i.e. not pressed). + Return if this input event is an echo event (only for events of type KEY, i.e. always false for this type). + Return if this input event is pressed. @@ -15131,70 +15241,99 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Change the input event to an action event of the given name with the pressed status passed as argument. + Event identifier, positive integer increased at each new event. + State of the Alt modifier. + Mouse button identifier, one of the BUTTON_* or BUTTON_WHEEL_* constants in [@Global Scope]. + Mouse button mask identifier, one of or a bitwise combination of the BUTTON_MASK_* constants in [@Global Scope]. + State of the Control modifier. + Device identifier. + Whether the event is a double-click. + Global position of the mouse click. + Global X coordinate of the mouse click. + Global Y coordinate of the mouse click. + State of the Meta modifier. + Local position of the mouse click. + Pressed state of the mouse button. + State of the Shift modifier. + Type of event (one of the [InputEvent] constants). + Local X coordinate of the mouse click. + Local Y coordinate of the mouse click. + Empty input event. + Key event. + Mouse motion event. + Mouse button event. + Joystick motion event. + Joystick button event. + Screen touch event. + Screen drag event. + Pre-defined action event (see [InputMap]). + Built-in input event type for mouse motion events. + Input event type for mouse motion events that extends the global [InputEvent] type. @@ -15203,6 +15342,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return if this input event matches a pre-defined action. @@ -15211,6 +15351,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is being pressed. Not relevant for MOUSE_MOTION events, always false. @@ -15219,18 +15360,21 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is released (i.e. not pressed). Not relevant for MOUSE_MOTION events, can be true or false depending on whether [method is_action] is true. + Return if this input event is an echo event (only for events of type KEY, i.e. always false for this type). + Return if this input event is pressed. Not relevant for MOUSE_MOTION events, always false. @@ -15239,76 +15383,108 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Change the input event to an action event of the given name with the (irrelevant for this type) pressed status passed as argument. + Event identifier, positive integer increased at each new event. + State of the Alt modifier. + Mouse button mask identifier, one of or a bitwise combination of the BUTTON_MASK_* constants in [@Global Scope]. + State of the Ctrl modifier. + Device identifier. + Global position of the mouse pointer. + Global X coordinate of the mouse pointer. + Global Y coordinate of the mouse pointer. + State of the Meta modifier. + Local position of the mouse pointer. + Position of the mouse pointer relative to the previous mouse position. + X coordinate of the mouse pointer relative to the previous mouse position. + Y coordinate of the mouse pointer relative to the previous mouse position. + State of the Shift modifier. + Speed of the mouse pointer. + Speed of the mouse pointer on the X axis. + Speed of the mouse pointer on the Y axis. + Type of event (one of the [InputEvent] constants). + Local X coordinate of the mouse pointer. + Local Y coordinate of the mouse pointer. + Empty input event. + Key event. + Mouse motion event. + Mouse button event. + Joystick motion event. + Joystick button event. + Screen touch event. + Screen drag event. + Pre-defined action event (see [InputMap]). + Built-in input event type for screen drag events. + Input event type for screen drag events that extends the global [InputEvent] type. @@ -15317,6 +15493,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return if this input event matches a pre-defined action. @@ -15325,6 +15502,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is being pressed. Not relevant for SCREEN_DRAG events, always false. @@ -15333,18 +15511,21 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is released (i.e. not pressed). Not relevant for SCREEN_DRAG events, can be true or false depending on whether [method is_action] is true. + Return if this input event is an echo event (only for events of type KEY, i.e. always false for this type). + Return if this input event is pressed. Not relevant for SCREEN_DRAG events, always false. @@ -15353,62 +15534,87 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Change the input event to an action event of the given name with the (irrelevant for this type) pressed status passed as argument. + Event identifier, positive integer increased at each new event. + Device identifier. + Drag event index in the case of a multi-drag event. + Position of the drag event. + Position of the drag event relative to its start position. + X coordinate of the drag event relative to its start position. + Y coordinate of the drag event relative to its start position. + Speed of the drag event. + Speed of the drag event on the X axis. + Speed of the drag event on the Y axis. + Type of event (one of the [InputEvent] constants). + X coordinate of the drag event. + Y coordinate of the drag event. + Empty input event. + Key event. + Mouse motion event. + Mouse button event. + Joystick motion event. + Joystick button event. + Screen touch event. + Screen drag event. + Pre-defined action event (see [InputMap]). + Built-in input event type for touchscreen drag events. + Input event type for touchscreen drag events that extends the global [InputEvent] type. @@ -15417,6 +15623,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return if this input event matches a pre-defined action. @@ -15425,6 +15632,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is being pressed. @@ -15433,18 +15641,21 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given action is released (i.e. not pressed). + Return if this input event is an echo event (only for events of type KEY, i.e. always false for this type). + Return if this input event is pressed. @@ -15453,45 +15664,63 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Change the input event to an action event of the given name with the pressed status passed as argument. + Event identifier, positive integer increased at each new event. + Device identifier. + Touch event index in the case of a multi-touch event. + Position of the touch event. + Pressed state of the touch event. + Type of event (one of the [InputEvent] constants). + X coordinate of the touch event. + Y coordinate of the touch event. + Empty input event. + Key event. + Mouse motion event. + Mouse button event. + Joystick motion event. + Joystick button event. + Screen touch event. + Screen drag event. + Pre-defined action event (see [InputMap]). @@ -15509,7 +15738,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) - Add an [InputEvent] to action. This [InputEvent] will trigger the action. + Add an [InputEvent] to an action. This [InputEvent] will trigger the action. @@ -15536,7 +15765,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) - Add an action to the [InputMap]. + Add an (empty) action to the [InputMap]. An [InputEvent] can then be added to this action with [method action_add_event]. @@ -15554,6 +15783,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) + Return whether the given event is part of an existing action. @@ -15562,7 +15792,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) - Return the action from an id. + Return the action corresponding to the identifier. @@ -15571,7 +15801,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) - Return the id of an action. + Return the identifier of the given action. @@ -15580,14 +15810,14 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) - Return an [Array] of [InputEvent]s associated with an action. + Return an array of InputEvents associated with a given action. - Return an [Array] of all actions in the [InputMap]. + Return an array of all actions in the [InputMap]. @@ -15596,12 +15826,12 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) - Whether this InputMap has an action with name "action". + Whether this InputMap has a registered action with the given name. - Clears the [InputMap] and loads it from [Globals]. + Clear the [InputMap] and load it anew from [Globals].