Godot Engine 3.2 Alpha2
Input继承于Object,是一个单例类,用于处理输入事件
常用方法
| 类型 | 方法名 | 说明 |
|---|---|---|
| void | action_press ( String action, float strength=1.0 ) | 用于模拟按键按下事件,注:不会触发_input |
| void | action_release ( String action ) | 如果指定按键被按下了,可用它触发其release |
| void | add_joy_mapping ( String mapping, bool update_existing=false ) | |
| Vector3 | get_accelerometer ( ) const | |
| float | get_action_strength ( String action ) const | |
| Array | get_connected_joypads ( ) | |
| Vector3 | get_gravity ( ) const | |
| Vector3 | get_gyroscope ( ) const | |
| float | get_joy_axis ( int device, int axis ) const | |
| int | get_joy_axis_index_from_string ( String axis ) | |
| String | get_joy_axis_string ( int axis_index ) | |
| int | get_joy_button_index_from_string ( String button ) | |
| String | get_joy_button_string ( int button_index ) | |
| String | get_joy_guid ( int device ) const | |
| String | get_joy_name ( int device ) | |
| float | get_joy_vibration_duration ( int device ) | |
| Vector2 | get_joy_vibration_strength ( int device ) | |
| Vector2 | get_last_mouse_speed ( ) const | |
| Vector3 | get_magnetometer ( ) const | |
| int | get_mouse_button_mask ( ) const | |
| MouseMode | get_mouse_mode ( ) const | |
| bool | is_action_just_pressed ( String action ) const | 判断某预定义action刚刚按下 |
| bool | is_action_just_released ( String action ) const | 判断某预定义action刚刚释放 |
| bool | is_action_pressed ( String action ) const | 判断某预定义action被按下 |
| bool | is_joy_button_pressed ( int device, int button ) const | |
| bool | is_joy_known ( int device ) | 是否为已知手柄 |
| bool | is_key_pressed ( int scancode ) const | 判断某键盘按键被按下 |
| bool | is_mouse_button_pressed ( int button ) const | 判断鼠标某按键被按下 |
| void | joy_connection_changed ( int device, bool connected, String name, String guid ) | |
| void | parse_input_event ( InputEvent event ) | |
| void | remove_joy_mapping ( String guid ) | |
| void | set_custom_mouse_cursor ( Resource image, CursorShape shape=0, Vector2 hotspot=Vector2( 0, 0 ) ) | |
| void | set_default_cursor_shape ( CursorShape shape=0 ) | |
| void | set_mouse_mode ( MouseMode mode ) | |
| void | set_use_accumulated_input ( bool enable ) | |
| void | start_joy_vibration ( int device, float weak_magnitude, float strong_magnitude, float duration=0 ) | 开启手柄震动 |
| void | stop_joy_vibration ( int device ) | 停止手柄震动 |
| void | warp_mouse_position ( Vector2 to ) | 强制把鼠标光标放到to的位置 |
