summaryrefslogtreecommitdiffstats
path: root/core/input/input.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/input/input.h')
-rw-r--r--core/input/input.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/core/input/input.h b/core/input/input.h
index bedc3fa0e3..dd613c4877 100644
--- a/core/input/input.h
+++ b/core/input/input.h
@@ -44,6 +44,8 @@ class Input : public Object {
static Input *singleton;
+ static constexpr uint64_t MAX_EVENT = 31;
+
public:
enum MouseMode {
MOUSE_MODE_VISIBLE,
@@ -103,11 +105,22 @@ private:
uint64_t pressed_process_frame = UINT64_MAX;
uint64_t released_physics_frame = UINT64_MAX;
uint64_t released_process_frame = UINT64_MAX;
- int pressed = 0;
- bool axis_pressed = false;
+ uint64_t pressed = 0;
bool exact = true;
float strength = 0.0f;
float raw_strength = 0.0f;
+ LocalVector<float> strengths;
+ LocalVector<float> raw_strengths;
+
+ Action() {
+ strengths.resize(MAX_EVENT + 1);
+ raw_strengths.resize(MAX_EVENT + 1);
+
+ for (uint64_t i = 0; i <= MAX_EVENT; i++) {
+ strengths[i] = 0.0;
+ raw_strengths[i] = 0.0;
+ }
+ }
};
HashMap<StringName, Action> action_state;
@@ -227,6 +240,8 @@ private:
JoyAxis _get_output_axis(String output);
void _button_event(int p_device, JoyButton p_index, bool p_pressed);
void _axis_event(int p_device, JoyAxis p_axis, float p_value);
+ void _update_action_strength(Action &p_action, int p_event_index, float p_strength);
+ void _update_action_raw_strength(Action &p_action, int p_event_index, float p_strength);
void _parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_emulated);