diff options
Diffstat (limited to 'main/input_default.h')
-rw-r--r-- | main/input_default.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/main/input_default.h b/main/input_default.h index 0479fdc0ff..2e3cae8520 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -55,11 +55,15 @@ class InputDefault : public Input { uint64_t physics_frame; uint64_t idle_frame; bool pressed; + float strength; }; Map<StringName, Action> action_state; - bool emulate_touch; + bool emulate_touch_from_mouse; + bool emulate_mouse_from_touch; + + int mouse_from_touch_index; struct VibrationInfo { float weak_magnitude; @@ -96,7 +100,6 @@ class InputDefault : public Input { int hat_current; Joypad() { - for (int i = 0; i < JOY_AXIS_MAX; i++) { last_axis[i] = 0.0f; @@ -109,13 +112,14 @@ class InputDefault : public Input { last_hat = HAT_MASK_CENTER; filter = 0.01f; mapping = -1; + hat_current = 0; } }; SpeedTrack mouse_speed_track; Map<int, Joypad> joy_names; int fallback_mapping; - RES custom_cursor; + CursorShape default_shape = CURSOR_ARROW; public: enum HatMask { @@ -175,6 +179,8 @@ private: void _axis_event(int p_device, int p_axis, float p_value); float _handle_deadzone(int p_device, int p_axis, float p_value); + void _parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_emulated); + public: virtual bool is_key_pressed(int p_scancode) const; virtual bool is_mouse_button_pressed(int p_button) const; @@ -182,6 +188,7 @@ public: virtual bool is_action_pressed(const StringName &p_action) const; virtual bool is_action_just_pressed(const StringName &p_action) const; virtual bool is_action_just_released(const StringName &p_action) const; + virtual float get_action_strength(const StringName &p_action) const; virtual float get_joy_axis(int p_device, int p_axis) const; String get_joy_name(int p_idx); @@ -223,9 +230,15 @@ public: void iteration(float p_step); - void set_emulate_touch(bool p_emulate); - virtual bool is_emulating_touchscreen() const; + void set_emulate_touch_from_mouse(bool p_emulate); + virtual bool is_emulating_touch_from_mouse() const; + void ensure_touch_mouse_raised(); + + void set_emulate_mouse_from_touch(bool p_emulate); + virtual bool is_emulating_mouse_from_touch() const; + virtual CursorShape get_default_cursor_shape(); + virtual void set_default_cursor_shape(CursorShape p_shape); virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape = Input::CURSOR_ARROW, const Vector2 &p_hotspot = Vector2()); virtual void set_mouse_in_window(bool p_in_window); |