From 1abdffe7a029daf634f57132cb5ab5d82a7ccfc9 Mon Sep 17 00:00:00 2001 From: kobewi Date: Fri, 5 Aug 2022 20:35:08 +0200 Subject: Replace Array return types with TypedArray 2 --- core/input/input_map.cpp | 9 +++++---- core/input/input_map.h | 7 +++++-- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'core/input') diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp index 942c5248df..702e257fb4 100644 --- a/core/input/input_map.cpp +++ b/core/input/input_map.cpp @@ -34,6 +34,7 @@ #include "core/input/input.h" #include "core/os/keyboard.h" #include "core/os/os.h" +#include "core/variant/typed_array.h" InputMap *InputMap::singleton = nullptr; @@ -99,8 +100,8 @@ void InputMap::erase_action(const StringName &p_action) { input_map.erase(p_action); } -Array InputMap::_get_actions() { - Array ret; +TypedArray InputMap::_get_actions() { + TypedArray ret; List actions = get_actions(); if (actions.is_empty()) { return ret; @@ -190,8 +191,8 @@ void InputMap::action_erase_events(const StringName &p_action) { input_map[p_action].inputs.clear(); } -Array InputMap::_action_get_events(const StringName &p_action) { - Array ret; +TypedArray InputMap::_action_get_events(const StringName &p_action) { + TypedArray ret; const List> *al = action_get_events(p_action); if (al) { for (const List>::Element *E = al->front(); E; E = E->next()) { diff --git a/core/input/input_map.h b/core/input/input_map.h index 2400a4a3f7..414a06b2f1 100644 --- a/core/input/input_map.h +++ b/core/input/input_map.h @@ -36,6 +36,9 @@ #include "core/object/object.h" #include "core/templates/hash_map.h" +template +class TypedArray; + class InputMap : public Object { GDCLASS(InputMap, Object); @@ -60,8 +63,8 @@ private: List>::Element *_find_event(Action &p_action, const Ref &p_event, bool p_exact_match = false, bool *r_pressed = nullptr, float *r_strength = nullptr, float *r_raw_strength = nullptr) const; - Array _action_get_events(const StringName &p_action); - Array _get_actions(); + TypedArray _action_get_events(const StringName &p_action); + TypedArray _get_actions(); protected: static void _bind_methods(); -- cgit v1.2.3