Merge pull request #12221 from Jerome67000/docs_input

[DOCS] InputEvent*
This commit is contained in:
Nathan Lovato 2017-10-21 12:02:18 +02:00 committed by GitHub
commit 5cbab0e001
12 changed files with 74 additions and 43 deletions

View file

@ -4,8 +4,10 @@
Generic input event Generic input event
</brief_description> </brief_description>
<description> <description>
Base class of all sort of input event. See [method Node._input].
</description> </description>
<tutorials> <tutorials>
http://docs.godotengine.org/en/stable/learning/features/inputs/inputevent.html
</tutorials> </tutorials>
<demos> <demos>
</demos> </demos>
@ -16,7 +18,7 @@
<argument index="0" name="event" type="InputEvent"> <argument index="0" name="event" type="InputEvent">
</argument> </argument>
<description> <description>
Returns true if this input event matches the event passed. Returns [code]true[/code] if this event matches [code]event[event].
</description> </description>
</method> </method>
<method name="as_text" qualifiers="const"> <method name="as_text" qualifiers="const">
@ -30,14 +32,14 @@
<return type="int"> <return type="int">
</return> </return>
<description> <description>
Returns the id of the device that generated the event. Returns the device's id that generated the event.
</description> </description>
</method> </method>
<method name="get_id" qualifiers="const"> <method name="get_id" qualifiers="const">
<return type="int"> <return type="int">
</return> </return>
<description> <description>
Returns the id of the event. Returns the event's ID.
</description> </description>
</method> </method>
<method name="is_action" qualifiers="const"> <method name="is_action" qualifiers="const">
@ -46,7 +48,7 @@
<argument index="0" name="action" type="String"> <argument index="0" name="action" type="String">
</argument> </argument>
<description> <description>
Returns true if this input event matches a pre-defined action, no matter the type. Returns [code]true[/code] if this input event matches a pre-defined action of any type.
</description> </description>
</method> </method>
<method name="is_action_pressed" qualifiers="const"> <method name="is_action_pressed" qualifiers="const">
@ -55,7 +57,7 @@
<argument index="0" name="action" type="String"> <argument index="0" name="action" type="String">
</argument> </argument>
<description> <description>
Returns true if 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. Returns [code]true[/code] if the given action is being pressed (and is not an echo event for KEY events). Not relevant for the event types [code]MOUSE_MOTION[/code], [code]SCREEN_DRAG[/code] or [code]NONE[/code].
</description> </description>
</method> </method>
<method name="is_action_released" qualifiers="const"> <method name="is_action_released" qualifiers="const">
@ -64,27 +66,28 @@
<argument index="0" name="action" type="String"> <argument index="0" name="action" type="String">
</argument> </argument>
<description> <description>
Returns true if the given action is released (i.e. not pressed). Not relevant for the event types MOUSE_MOTION, SCREEN_DRAG and NONE. Returns [code]true[/code] if the given action is released (i.e. not pressed). Not relevant for the event types [code]MOUSE_MOTION[/code], [code]SCREEN_DRAG[/code] or [code]NONE[/code].
</description> </description>
</method> </method>
<method name="is_action_type" qualifiers="const"> <method name="is_action_type" qualifiers="const">
<return type="bool"> <return type="bool">
</return> </return>
<description> <description>
Returns [code]true[/code] if this input event's type is one of the [code]InputEvent[/code] constants.
</description> </description>
</method> </method>
<method name="is_echo" qualifiers="const"> <method name="is_echo" qualifiers="const">
<return type="bool"> <return type="bool">
</return> </return>
<description> <description>
Returns true if this input event is an echo event (only for events of type KEY, it will return false for other types). Returns [code]true[/code] if this input event is an echo event (only for events of type KEY).
</description> </description>
</method> </method>
<method name="is_pressed" qualifiers="const"> <method name="is_pressed" qualifiers="const">
<return type="bool"> <return type="bool">
</return> </return>
<description> <description>
Returns true if this input event is pressed. Not relevant for the event types MOUSE_MOTION, SCREEN_DRAG and NONE. Returns [code]true[/code] if this input event is pressed. Not relevant for the event types [code]MOUSE_MOTION[/code], [code]SCREEN_DRAG[/code] or [code]NONE[/code].
</description> </description>
</method> </method>
<method name="set_device"> <method name="set_device">
@ -124,6 +127,7 @@
</methods> </methods>
<members> <members>
<member name="device" type="int" setter="set_device" getter="get_device"> <member name="device" type="int" setter="set_device" getter="get_device">
The event's device ID.
</member> </member>
</members> </members>
<constants> <constants>

View file

@ -4,8 +4,10 @@
Input event type for actions. Input event type for actions.
</brief_description> </brief_description>
<description> <description>
Contains a generic action which can be targeted from several type of inputs. Actions can be created from the project settings menu [code]Project > Project Settings > Input Map[/Code]. See [method Node._input].
</description> </description>
<tutorials> <tutorials>
http://docs.godotengine.org/en/stable/learning/features/inputs/inputevent.html#actions
</tutorials> </tutorials>
<demos> <demos>
</demos> </demos>
@ -35,8 +37,10 @@
</methods> </methods>
<members> <members>
<member name="action" type="String" setter="set_action" getter="get_action"> <member name="action" type="String" setter="set_action" getter="get_action">
The action's name. Actions are accessed via this [String].
</member> </member>
<member name="pressed" type="bool" setter="set_pressed" getter="is_pressed"> <member name="pressed" type="bool" setter="set_pressed" getter="is_pressed">
If [code]true[/code] the action's state is pressed. If [code]false[/code] the action's state is released.
</member> </member>
</members> </members>
<constants> <constants>

View file

@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="InputEventJoypadButton" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build"> <class name="InputEventJoypadButton" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build">
<brief_description> <brief_description>
Input event type for joypad button events. Input event for gamepad buttons.
</brief_description> </brief_description>
<description> <description>
Input event type for gamepad buttons. For joysticks see [InputEventJoypadMotion].
</description> </description>
<tutorials> <tutorials>
http://docs.godotengine.org/en/stable/learning/features/inputs/inputevent.html
</tutorials> </tutorials>
<demos> <demos>
</demos> </demos>
@ -49,13 +51,13 @@
</methods> </methods>
<members> <members>
<member name="button_index" type="int" setter="set_button_index" getter="get_button_index"> <member name="button_index" type="int" setter="set_button_index" getter="get_button_index">
Joypad button identifier, one of the JOY_BUTTON_* constants in [@Global Scope]. Button identifier. One of the [code]JOY_BUTTON_*[/code] constants from [@global Scope].
</member> </member>
<member name="pressed" type="bool" setter="set_pressed" getter="is_pressed"> <member name="pressed" type="bool" setter="set_pressed" getter="is_pressed">
Pressed state of the joypad button. If [code]true[/code] the button's state is pressed. If [code]false[/code] the button's state is released.
</member> </member>
<member name="pressure" type="float" setter="set_pressure" getter="get_pressure"> <member name="pressure" type="float" setter="set_pressure" getter="get_pressure">
Intensity of the button pressure, ranges from 0 to 1.0. Represents the pressure the user puts on the button with his finger, if the controller supports it. Ranges from [code]0[/code] to [code]1[/code].
</member> </member>
</members> </members>
<constants> <constants>

View file

@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="InputEventJoypadMotion" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build"> <class name="InputEventJoypadMotion" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build">
<brief_description> <brief_description>
Input event type for joypad motion/axis events. Input event type for gamepad joysticks and other motions. For buttons see [InputEventJoypadMotion].
</brief_description> </brief_description>
<description> <description>
Stores information about joystick motions. One [code]InputEventJoypadMotion[/code] represents one axis at a time.
</description> </description>
<tutorials> <tutorials>
http://docs.godotengine.org/en/stable/learning/features/inputs/inputevent.html
</tutorials> </tutorials>
<demos> <demos>
</demos> </demos>
@ -41,10 +43,10 @@
</methods> </methods>
<members> <members>
<member name="axis" type="int" setter="set_axis" getter="get_axis"> <member name="axis" type="int" setter="set_axis" getter="get_axis">
Joypad axis identifier, one of the JOY_AXIS_* constants in [@Global Scope]. Axis identifier. Use one of the [code]JOY_AXIS_*[/code] constants in [@global Scope].
</member> </member>
<member name="axis_value" type="float" setter="set_axis_value" getter="get_axis_value"> <member name="axis_value" type="float" setter="set_axis_value" getter="get_axis_value">
Position of the axis, ranging from -1.0 to 1.0. A value of 0 means that the axis is in its neutral position. Current position of the joystick on the given axis. The value ranges from [code]-1.0[/code] to [code]1.0[/code]. A value of [code]0[/code] means the axis is in its resting position.
</member> </member>
</members> </members>
<constants> <constants>

View file

@ -4,8 +4,10 @@
Input event type for keyboard events. Input event type for keyboard events.
</brief_description> </brief_description>
<description> <description>
Stores key presses on the keyboard. Supports key presses, key releases and [member echo] events.
</description> </description>
<tutorials> <tutorials>
http://docs.godotengine.org/en/stable/learning/features/inputs/inputevent.html
</tutorials> </tutorials>
<demos> <demos>
</demos> </demos>
@ -63,16 +65,16 @@
</methods> </methods>
<members> <members>
<member name="echo" type="bool" setter="set_echo" getter="is_echo"> <member name="echo" type="bool" setter="set_echo" getter="is_echo">
Echo state of the key, i.e. whether it's a repeat event or not. If [code]true[/code] the key was already pressed before this event. It means the user is holding the key down.
</member> </member>
<member name="pressed" type="bool" setter="set_pressed" getter="is_pressed"> <member name="pressed" type="bool" setter="set_pressed" getter="is_pressed">
Pressed state of the key. If [code]true[/code] the key's state is pressed. If [code]false[/code] the key's state is released.
</member> </member>
<member name="scancode" type="int" setter="set_scancode" getter="get_scancode"> <member name="scancode" type="int" setter="set_scancode" getter="get_scancode">
Scancode of the key, one of the KEY_* constants in [@Global Scope]. Key scancode, one of the [code]KEY_*[/code] constants in [@global Scope].
</member> </member>
<member name="unicode" type="int" setter="set_unicode" getter="get_unicode"> <member name="unicode" type="int" setter="set_unicode" getter="get_unicode">
Unicode identifier of the key (when relevant). Key unicode identifier when relevant.
</member> </member>
</members> </members>
<constants> <constants>

View file

@ -4,8 +4,10 @@
Base input event type for mouse events. Base input event type for mouse events.
</brief_description> </brief_description>
<description> <description>
Stores general mouse events informations.
</description> </description>
<tutorials> <tutorials>
http://docs.godotengine.org/en/stable/learning/features/inputs/inputevent.html
</tutorials> </tutorials>
<demos> <demos>
</demos> </demos>
@ -58,10 +60,10 @@
Mouse button mask identifier, one of or a bitwise combination of the BUTTON_MASK_* constants in [@Global Scope]. Mouse button mask identifier, one of or a bitwise combination of the BUTTON_MASK_* constants in [@Global Scope].
</member> </member>
<member name="global_position" type="Vector2" setter="set_global_position" getter="get_global_position"> <member name="global_position" type="Vector2" setter="set_global_position" getter="get_global_position">
Global position of the mouse click. Mouse position relative to the current [Viewport] when used in [method Control._gui_input], otherwise is at 0,0.
</member> </member>
<member name="position" type="Vector2" setter="set_position" getter="get_position"> <member name="position" type="Vector2" setter="set_position" getter="get_position">
Local position of the mouse click. Mouse local position relative to the [Viewport]. If used in [method Control._gui_input] the position is relative to the current [Control] wich is under the mouse.
</member> </member>
</members> </members>
<constants> <constants>

View file

@ -4,8 +4,10 @@
Input event type for mouse button events. Input event type for mouse button events.
</brief_description> </brief_description>
<description> <description>
Contains mouse click informations. See [method Node._input].
</description> </description>
<tutorials> <tutorials>
http://docs.godotengine.org/en/stable/learning/features/inputs/inputevent.html
</tutorials> </tutorials>
<demos> <demos>
</demos> </demos>
@ -66,12 +68,13 @@
Mouse button identifier, one of the BUTTON_* or BUTTON_WHEEL_* constants in [@Global Scope]. Mouse button identifier, one of the BUTTON_* or BUTTON_WHEEL_* constants in [@Global Scope].
</member> </member>
<member name="doubleclick" type="bool" setter="set_doubleclick" getter="is_doubleclick"> <member name="doubleclick" type="bool" setter="set_doubleclick" getter="is_doubleclick">
Whether the event is a double-click. If [code]true[/code] the mouse button's state is a double-click. If [code]false[/code] the mouse button's state is released.
</member> </member>
<member name="factor" type="float" setter="set_factor" getter="get_factor"> <member name="factor" type="float" setter="set_factor" getter="get_factor">
TO TALK in PR, reduz said : i think it's used for apple touch but i don't remember what it does
</member> </member>
<member name="pressed" type="bool" setter="set_pressed" getter="is_pressed"> <member name="pressed" type="bool" setter="set_pressed" getter="is_pressed">
Pressed state of the mouse button. If [code]true[/code] the mouse button's state is pressed. If [code]false[/code] the mouse button's state is released.
</member> </member>
</members> </members>
<constants> <constants>

View file

@ -4,8 +4,10 @@
Input event type for mouse motion events. Input event type for mouse motion events.
</brief_description> </brief_description>
<description> <description>
Contains mouse motion informations. Supports relative, absolute positions and speed. See [method Node._input].
</description> </description>
<tutorials> <tutorials>
http://docs.godotengine.org/en/stable/learning/features/inputs/inputevent.html
</tutorials> </tutorials>
<demos> <demos>
</demos> </demos>
@ -41,10 +43,10 @@
</methods> </methods>
<members> <members>
<member name="relative" type="Vector2" setter="set_relative" getter="get_relative"> <member name="relative" type="Vector2" setter="set_relative" getter="get_relative">
Position of the mouse pointer relative to the previous mouse position. Mouse position relative to the previous position (position at the last frame).
</member> </member>
<member name="speed" type="Vector2" setter="set_speed" getter="get_speed"> <member name="speed" type="Vector2" setter="set_speed" getter="get_speed">
Speed of the mouse pointer. Mouse speed.
</member> </member>
</members> </members>
<constants> <constants>

View file

@ -2,10 +2,13 @@
<class name="InputEventScreenDrag" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build"> <class name="InputEventScreenDrag" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build">
<brief_description> <brief_description>
Input event type for screen drag events. Input event type for screen drag events.
(only available on mobile devices)
</brief_description> </brief_description>
<description> <description>
Contains screen drag informations. See [method Node._input].
</description> </description>
<tutorials> <tutorials>
http://docs.godotengine.org/en/stable/learning/features/inputs/inputevent.html
</tutorials> </tutorials>
<demos> <demos>
</demos> </demos>
@ -72,13 +75,13 @@
Drag event index in the case of a multi-drag event. Drag event index in the case of a multi-drag event.
</member> </member>
<member name="position" type="Vector2" setter="set_position" getter="get_position"> <member name="position" type="Vector2" setter="set_position" getter="get_position">
Position of the drag event. Drag position.
</member> </member>
<member name="relative" type="Vector2" setter="set_relative" getter="get_relative"> <member name="relative" type="Vector2" setter="set_relative" getter="get_relative">
Position of the drag event relative to its start position. Drag position relative to its start position.
</member> </member>
<member name="speed" type="Vector2" setter="set_speed" getter="get_speed"> <member name="speed" type="Vector2" setter="set_speed" getter="get_speed">
Speed of the drag event. Drag speed.
</member> </member>
</members> </members>
<constants> <constants>

View file

@ -2,10 +2,13 @@
<class name="InputEventScreenTouch" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build"> <class name="InputEventScreenTouch" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build">
<brief_description> <brief_description>
Input event type for screen touch events. Input event type for screen touch events.
(only available on mobile devices)
</brief_description> </brief_description>
<description> <description>
Stores multi-touch press/release information. Supports touch press, touch release and [member index] for multi-touch count and order.
</description> </description>
<tutorials> <tutorials>
http://docs.godotengine.org/en/stable/learning/features/inputs/inputevent.html
</tutorials> </tutorials>
<demos> <demos>
</demos> </demos>
@ -49,13 +52,13 @@
</methods> </methods>
<members> <members>
<member name="index" type="int" setter="set_index" getter="get_index"> <member name="index" type="int" setter="set_index" getter="get_index">
Touch event index in the case of a multi-touch event. Touch index in the case of a multi-touch event. One index = one finger.
</member> </member>
<member name="position" type="Vector2" setter="set_position" getter="get_position"> <member name="position" type="Vector2" setter="set_position" getter="get_position">
Position of the touch event. Touch position.
</member> </member>
<member name="pressed" type="bool" setter="set_pressed" getter="is_pressed"> <member name="pressed" type="bool" setter="set_pressed" getter="is_pressed">
Pressed state of the touch event. If [code]true[/code] the touch's state is pressed. If [code]false[/code] the touch's state is released.
</member> </member>
</members> </members>
<constants> <constants>

View file

@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="InputEventWithModifiers" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build"> <class name="InputEventWithModifiers" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build">
<brief_description> <brief_description>
Base class for input events with modifiers. Base class for keys events with modifiers.
</brief_description> </brief_description>
<description> <description>
Contains keys events informations with modifiers support like [code]SHIFT[/code] or [code]ALT[/code]. See [method Node._input].
</description> </description>
<tutorials> <tutorials>
http://docs.godotengine.org/en/stable/learning/features/inputs/inputevent.html
</tutorials> </tutorials>
<demos> <demos>
</demos> </demos>

View file

@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="InputMap" inherits="Object" category="Core" version="3.0.alpha.custom_build"> <class name="InputMap" inherits="Object" category="Core" version="3.0.alpha.custom_build">
<brief_description> <brief_description>
Singleton that manages actions. Singleton that manages [InputEventAction].
</brief_description> </brief_description>
<description> <description>
Manages all [InputEventAction] which can be created/modified from the project settings menu [code]Project > Project Settings > Input Map[/Code] or in code with [method add_action] and [method action_add_event]. See [method Node._input].
</description> </description>
<tutorials> <tutorials>
http://docs.godotengine.org/en/stable/learning/features/inputs/inputevent.html#inputmap
</tutorials> </tutorials>
<demos> <demos>
</demos> </demos>
@ -18,7 +20,7 @@
<argument index="1" name="event" type="InputEvent"> <argument index="1" name="event" type="InputEvent">
</argument> </argument>
<description> <description>
Add an [InputEvent] to an action. This [InputEvent] will trigger the action. Adds an [InputEvent] to an action. This [InputEvent] will trigger the action.
</description> </description>
</method> </method>
<method name="action_erase_event"> <method name="action_erase_event">
@ -29,7 +31,7 @@
<argument index="1" name="event" type="InputEvent"> <argument index="1" name="event" type="InputEvent">
</argument> </argument>
<description> <description>
Remove an [InputEvent] from an action. Removes an [InputEvent] from an action.
</description> </description>
</method> </method>
<method name="action_has_event"> <method name="action_has_event">
@ -40,7 +42,7 @@
<argument index="1" name="event" type="InputEvent"> <argument index="1" name="event" type="InputEvent">
</argument> </argument>
<description> <description>
Whether an action has an [InputEvent] associated with it. Returns [true] if an action has an [InputEvent] associated with it.
</description> </description>
</method> </method>
<method name="add_action"> <method name="add_action">
@ -49,7 +51,7 @@
<argument index="0" name="action" type="String"> <argument index="0" name="action" type="String">
</argument> </argument>
<description> <description>
Add an (empty) action to the [InputMap]. An [InputEvent] can then be added to this action with [method action_add_event]. Adds an (empty) action to the [InputMap]. An [InputEvent] can then be added to this action with [method action_add_event].
</description> </description>
</method> </method>
<method name="erase_action"> <method name="erase_action">
@ -58,7 +60,7 @@
<argument index="0" name="action" type="String"> <argument index="0" name="action" type="String">
</argument> </argument>
<description> <description>
Remove an action from the [InputMap]. Removes an action from the [code]InputMap[/code].
</description> </description>
</method> </method>
<method name="event_is_action" qualifiers="const"> <method name="event_is_action" qualifiers="const">
@ -69,7 +71,7 @@
<argument index="1" name="action" type="String"> <argument index="1" name="action" type="String">
</argument> </argument>
<description> <description>
Return whether the given event is part of an existing action. This method ignores keyboard modifiers if the given [InputEvent] is not pressed (for proper release detection). See [method action_has_event] if you don't want this behavior. Returns [true] if the given event is part of an existing action. This method ignores keyboard modifiers if the given [InputEvent] is not pressed (for proper release detection). See [method action_has_event] if you don't want this behavior.
</description> </description>
</method> </method>
<method name="get_action_list"> <method name="get_action_list">
@ -78,14 +80,14 @@
<argument index="0" name="action" type="String"> <argument index="0" name="action" type="String">
</argument> </argument>
<description> <description>
Return an array of InputEvents associated with a given action. Returns an array of [InputEvent]s associated with a given action.
</description> </description>
</method> </method>
<method name="get_actions"> <method name="get_actions">
<return type="Array"> <return type="Array">
</return> </return>
<description> <description>
Return an array of all actions in the [InputMap]. Returns an array of all actions in the [code]InputMap[/code].
</description> </description>
</method> </method>
<method name="has_action" qualifiers="const"> <method name="has_action" qualifiers="const">
@ -94,14 +96,14 @@
<argument index="0" name="action" type="String"> <argument index="0" name="action" type="String">
</argument> </argument>
<description> <description>
Whether this InputMap has a registered action with the given name. Returns [code]true[/code] if the [code]InputMap[/code] has a registered action with the given name.
</description> </description>
</method> </method>
<method name="load_from_globals"> <method name="load_from_globals">
<return type="void"> <return type="void">
</return> </return>
<description> <description>
Clear the [InputMap] and load it anew from [ProjectSettings]. Clears all [InputEventAction] in the [code]InputMap[/code] and load it anew from [ProjectSettings].
</description> </description>
</method> </method>
</methods> </methods>