Add methods to check which event first triggered "just pressed/released" state.

This commit is contained in:
Pāvels Nadtočajevs
2025-08-12 11:56:35 +03:00
parent ca452113d4
commit 10fd7163d4
7 changed files with 114 additions and 17 deletions

View File

@ -109,6 +109,8 @@ private:
uint64_t pressed_process_frame = UINT64_MAX;
uint64_t released_physics_frame = UINT64_MAX;
uint64_t released_process_frame = UINT64_MAX;
ObjectID pressed_event_id;
ObjectID released_event_id;
bool exact = true;
struct DeviceState {
@ -306,6 +308,8 @@ public:
bool is_action_pressed(const StringName &p_action, bool p_exact = false) const;
bool is_action_just_pressed(const StringName &p_action, bool p_exact = false) const;
bool is_action_just_released(const StringName &p_action, bool p_exact = false) const;
bool is_action_just_pressed_by_event(const StringName &p_action, const Ref<InputEvent> &p_event, bool p_exact = false) const;
bool is_action_just_released_by_event(const StringName &p_action, const Ref<InputEvent> &p_event, bool p_exact = false) const;
float get_action_strength(const StringName &p_action, bool p_exact = false) const;
float get_action_raw_strength(const StringName &p_action, bool p_exact = false) const;