:github_url: hide .. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the InputEvent.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_InputEvent: InputEvent ========== **Inherits:** :ref:`Resource` **<** :ref:`Reference` **<** :ref:`Object` **Inherited By:** :ref:`InputEventAction`, :ref:`InputEventJoypadButton`, :ref:`InputEventJoypadMotion`, :ref:`InputEventMIDI`, :ref:`InputEventScreenDrag`, :ref:`InputEventScreenTouch`, :ref:`InputEventWithModifiers` **Category:** Core Brief Description ----------------- Generic input event Properties ---------- +-----------------------+-------------------------------------------------+ | :ref:`int` | :ref:`device` | +-----------------------+-------------------------------------------------+ Methods ------- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`accumulate` **(** :ref:`InputEvent` with_event **)** | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`as_text` **(** **)** const | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_action_strength` **(** :ref:`String` action **)** const | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_action` **(** :ref:`String` action **)** const | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_action_pressed` **(** :ref:`String` action **)** const | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_action_released` **(** :ref:`String` action **)** const | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_action_type` **(** **)** const | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_echo` **(** **)** const | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_pressed` **(** **)** const | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`shortcut_match` **(** :ref:`InputEvent` event **)** const | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`InputEvent` | :ref:`xformed_by` **(** :ref:`Transform2D` xform, :ref:`Vector2` local_ofs=Vector2( 0, 0 ) **)** const | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Description ----------- Base class of all sort of input event. See :ref:`Node._input`. Tutorials --------- - :doc:`../tutorials/inputs/inputevent` - :doc:`../tutorials/2d/2d_transforms` Property Descriptions --------------------- .. _class_InputEvent_property_device: - :ref:`int` **device** +----------+-------------------+ | *Setter* | set_device(value) | +----------+-------------------+ | *Getter* | get_device() | +----------+-------------------+ The event's device ID. Method Descriptions ------------------- .. _class_InputEvent_method_accumulate: - :ref:`bool` **accumulate** **(** :ref:`InputEvent` with_event **)** Returns ``true`` if the given input event and this input event can be added together (only for events of type :ref:`InputEventMouseMotion`). The given input event's position, global position and speed will be copied. The resulting ``relative`` is a sum of both events. Both events' modifiers have to be identical. ---- .. _class_InputEvent_method_as_text: - :ref:`String` **as_text** **(** **)** const Returns a :ref:`String` representation of the event. ---- .. _class_InputEvent_method_get_action_strength: - :ref:`float` **get_action_strength** **(** :ref:`String` action **)** const Returns a value between 0.0 and 1.0 depending on the given actions' state. Useful for getting the value of events of type :ref:`InputEventJoypadMotion`. ---- .. _class_InputEvent_method_is_action: - :ref:`bool` **is_action** **(** :ref:`String` action **)** const Returns ``true`` if this input event matches a pre-defined action of any type. ---- .. _class_InputEvent_method_is_action_pressed: - :ref:`bool` **is_action_pressed** **(** :ref:`String` action **)** const Returns ``true`` if the given action is being pressed (and is not an echo event for :ref:`InputEventKey` events). Not relevant for events of type :ref:`InputEventMouseMotion` or :ref:`InputEventScreenDrag`. ---- .. _class_InputEvent_method_is_action_released: - :ref:`bool` **is_action_released** **(** :ref:`String` action **)** const Returns ``true`` if the given action is released (i.e. not pressed). Not relevant for events of type :ref:`InputEventMouseMotion` or :ref:`InputEventScreenDrag`. ---- .. _class_InputEvent_method_is_action_type: - :ref:`bool` **is_action_type** **(** **)** const Returns ``true`` if this input event's type is one that can be assigned to an input action. ---- .. _class_InputEvent_method_is_echo: - :ref:`bool` **is_echo** **(** **)** const Returns ``true`` if this input event is an echo event (only for events of type :ref:`InputEventKey`). ---- .. _class_InputEvent_method_is_pressed: - :ref:`bool` **is_pressed** **(** **)** const Returns ``true`` if this input event is pressed. Not relevant for events of type :ref:`InputEventMouseMotion` or :ref:`InputEventScreenDrag`. ---- .. _class_InputEvent_method_shortcut_match: - :ref:`bool` **shortcut_match** **(** :ref:`InputEvent` event **)** const Returns ``true`` if the given input event is checking for the same key (:ref:`InputEventKey`), button (:ref:`InputEventJoypadButton`) or action (:ref:`InputEventAction`). ---- .. _class_InputEvent_method_xformed_by: - :ref:`InputEvent` **xformed_by** **(** :ref:`Transform2D` xform, :ref:`Vector2` local_ofs=Vector2( 0, 0 ) **)** const Returns a copy of the given input event which has been offset by ``local_ofs`` and transformed by ``xform``. Relevant for events of type :ref:`InputEventMouseButton`, :ref:`InputEventMouseMotion`, :ref:`InputEventScreenTouch`, :ref:`InputEventScreenDrag`, :ref:`InputEventMagnifyGesture` and :ref:`InputEventPanGesture`.