123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
- .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
- .. _class_Input:
- Input
- =====
- **Inherits:** :ref:`Object<class_object>`
- **Inherited By:** :ref:`InputDefault<class_inputdefault>`
- **Category:** Core
- Brief Description
- -----------------
- A Singleton that deals with inputs.
- Member Functions
- ----------------
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_key_pressed<class_Input_is_key_pressed>` **(** :ref:`int<class_int>` scancode **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_mouse_button_pressed<class_Input_is_mouse_button_pressed>` **(** :ref:`int<class_int>` button **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_joy_button_pressed<class_Input_is_joy_button_pressed>` **(** :ref:`int<class_int>` device, :ref:`int<class_int>` button **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_action_pressed<class_Input_is_action_pressed>` **(** :ref:`String<class_string>` action **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_joy_mapping<class_Input_add_joy_mapping>` **(** :ref:`String<class_string>` mapping, :ref:`bool<class_bool>` update_existing=false **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`remove_joy_mapping<class_Input_remove_joy_mapping>` **(** :ref:`String<class_string>` guid **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_joy_known<class_Input_is_joy_known>` **(** :ref:`int<class_int>` device **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_joy_axis<class_Input_get_joy_axis>` **(** :ref:`int<class_int>` device, :ref:`int<class_int>` axis **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`get_joy_name<class_Input_get_joy_name>` **(** :ref:`int<class_int>` device **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`get_joy_guid<class_Input_get_joy_guid>` **(** :ref:`int<class_int>` device **)** const |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Vector3<class_vector3>` | :ref:`get_accelerometer<class_Input_get_accelerometer>` **(** **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Vector2<class_vector2>` | :ref:`get_mouse_speed<class_Input_get_mouse_speed>` **(** **)** const |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_mouse_button_mask<class_Input_get_mouse_button_mask>` **(** **)** const |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_mouse_mode<class_Input_set_mouse_mode>` **(** :ref:`int<class_int>` mode **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_mouse_mode<class_Input_get_mouse_mode>` **(** **)** const |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`warp_mouse_pos<class_Input_warp_mouse_pos>` **(** :ref:`Vector2<class_vector2>` to **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`action_press<class_Input_action_press>` **(** :ref:`String<class_string>` action **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`action_release<class_Input_action_release>` **(** :ref:`String<class_string>` action **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_custom_mouse_cursor<class_Input_set_custom_mouse_cursor>` **(** :ref:`Texture<class_texture>` image, :ref:`Vector2<class_vector2>` hotspot=Vector2(0,0) **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- Signals
- -------
- - **joy_connection_changed** **(** :ref:`int<class_int>` index, :ref:`bool<class_bool>` connected **)**
- Numeric Constants
- -----------------
- - **MOUSE_MODE_VISIBLE** = **0** --- Makes the mouse cursor visible if it is hidden.
- - **MOUSE_MODE_HIDDEN** = **1** --- Makes the mouse cursor hidden if it is visible.
- - **MOUSE_MODE_CAPTURED** = **2** --- Captures the mouse. The mouse will be hidden and unable to leave the game window. But it will still register movement and mouse button presses.
- Description
- -----------
- A Singleton that deals with inputs. This includes key presses, mouse buttons and movement, joysticks, and input actions.
- Member Function Description
- ---------------------------
- .. _class_Input_is_key_pressed:
- - :ref:`bool<class_bool>` **is_key_pressed** **(** :ref:`int<class_int>` scancode **)**
- Returns true or false depending on whether the key is pressed or not. You can pass KEY\_\*, which are pre-defined constants listed in :ref:`@Global Scope<class_@global scope>`.
- .. _class_Input_is_mouse_button_pressed:
- - :ref:`bool<class_bool>` **is_mouse_button_pressed** **(** :ref:`int<class_int>` button **)**
- Returns true or false depending on whether mouse button is pressed or not. You can pass BUTTON\_\*, which are pre-defined constants listed in :ref:`@Global Scope<class_@global scope>`.
- .. _class_Input_is_joy_button_pressed:
- - :ref:`bool<class_bool>` **is_joy_button_pressed** **(** :ref:`int<class_int>` device, :ref:`int<class_int>` button **)**
- Returns if the joystick button at the given index is currently pressed. (see JOY\_\* constants in :ref:`@Global Scope<class_@global scope>`)
- .. _class_Input_is_action_pressed:
- - :ref:`bool<class_bool>` **is_action_pressed** **(** :ref:`String<class_string>` action **)**
- Returns true or false depending on whether the action event is pressed. Actions and their events can be set in the Project Settings / Input Map tab. Or be set with :ref:`InputMap<class_inputmap>`.
- .. _class_Input_add_joy_mapping:
- - void **add_joy_mapping** **(** :ref:`String<class_string>` mapping, :ref:`bool<class_bool>` update_existing=false **)**
- Add a new mapping entry (in SDL2 format) to the mapping database. Optionally update already connected devices.
- .. _class_Input_remove_joy_mapping:
- - void **remove_joy_mapping** **(** :ref:`String<class_string>` guid **)**
- Removes all mappings from the internal db that match the given uid.
- .. _class_Input_is_joy_known:
- - :ref:`bool<class_bool>` **is_joy_known** **(** :ref:`int<class_int>` device **)**
- Returns if the specified device is known by the system. This means that it sets all button and axis indices exactly as defined in the JOY\_\* constants (see :ref:`@Global Scope<class_@global scope>`). Unknown joysticks are not expected to match these constants, but you can still retrieve events from them.
- .. _class_Input_get_joy_axis:
- - :ref:`float<class_float>` **get_joy_axis** **(** :ref:`int<class_int>` device, :ref:`int<class_int>` axis **)**
- Returns the current value of the joystick axis at given index (see JOY\_\* constants in :ref:`@Global Scope<class_@global scope>`)
- .. _class_Input_get_joy_name:
- - :ref:`String<class_string>` **get_joy_name** **(** :ref:`int<class_int>` device **)**
- Returns the name of the joystick at the specified device index
- .. _class_Input_get_joy_guid:
- - :ref:`String<class_string>` **get_joy_guid** **(** :ref:`int<class_int>` device **)** const
- Returns a SDL2 compatible device guid on platforms that use gamepad remapping. Returns "Default Gamepad" otherwise.
- .. _class_Input_get_accelerometer:
- - :ref:`Vector3<class_vector3>` **get_accelerometer** **(** **)**
- If the device has an accelerometer, this will return the movement.
- .. _class_Input_get_mouse_speed:
- - :ref:`Vector2<class_vector2>` **get_mouse_speed** **(** **)** const
- Returns the mouse speed.
- .. _class_Input_get_mouse_button_mask:
- - :ref:`int<class_int>` **get_mouse_button_mask** **(** **)** const
- Returns mouse buttons as a bitmask. If multiple mouse buttons are pressed at the same time the bits are added together.
- .. _class_Input_set_mouse_mode:
- - void **set_mouse_mode** **(** :ref:`int<class_int>` mode **)**
- Set the mouse mode. See the constants for more information.
- .. _class_Input_get_mouse_mode:
- - :ref:`int<class_int>` **get_mouse_mode** **(** **)** const
- Return the mouse mode. See the constants for more information.
- .. _class_Input_warp_mouse_pos:
- - void **warp_mouse_pos** **(** :ref:`Vector2<class_vector2>` to **)**
- Sets the mouse position to the specified vector.
- .. _class_Input_action_press:
- - void **action_press** **(** :ref:`String<class_string>` action **)**
- This will simulate pressing the specificed action.
- .. _class_Input_action_release:
- - void **action_release** **(** :ref:`String<class_string>` action **)**
- If the specified action is already pressed, this will release it.
- .. _class_Input_set_custom_mouse_cursor:
- - void **set_custom_mouse_cursor** **(** :ref:`Texture<class_texture>` image, :ref:`Vector2<class_vector2>` hotspot=Vector2(0,0) **)**
- Set a custom mouse cursor image, which is only visible inside the game window. The hotspot can also be specified.
|