diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2020-10-24 05:22:35 -0400 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2020-11-11 05:58:21 -0500 |
commit | 195d58be0fc7ce5120e3909c5db87e08d9de6bdb (patch) | |
tree | d0b93d2883a63f69fa792f4557f69e3d97be8159 /core/input/input.cpp | |
parent | 10fd10759978f01e9152278e905f32c1117d2841 (diff) |
Add raw strength value for internal use
Diffstat (limited to 'core/input/input.cpp')
-rw-r--r-- | core/input/input.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/core/input/input.cpp b/core/input/input.cpp index ee66bf94cb..ef02827468 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -326,6 +326,15 @@ float Input::get_action_strength(const StringName &p_action) const { return E->get().strength; } +float Input::get_action_raw_strength(const StringName &p_action) const { + const Map<StringName, Action>::Element *E = action_state.find(p_action); + if (!E) { + return 0.0f; + } + + return E->get().raw_strength; +} + float Input::get_joy_axis(int p_device, int p_axis) const { _THREAD_SAFE_METHOD_ int c = _combine_device(p_axis, p_device); @@ -603,10 +612,12 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em action.physics_frame = Engine::get_singleton()->get_physics_frames(); action.idle_frame = Engine::get_singleton()->get_idle_frames(); action.pressed = p_event->is_action_pressed(E->key()); - action.strength = 0.f; + action.strength = 0.0f; + action.raw_strength = 0.0f; action_state[E->key()] = action; } action_state[E->key()].strength = p_event->get_action_strength(E->key()); + action_state[E->key()].raw_strength = p_event->get_action_raw_strength(E->key()); } } |