diff options
Diffstat (limited to 'core/input_map.cpp')
-rw-r--r-- | core/input_map.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/core/input_map.cpp b/core/input_map.cpp index 83b1e757da..1196c0c863 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -42,7 +42,7 @@ void InputMap::_bind_methods() { ObjectTypeDB::bind_method(_MD("action_add_event","action","event"),&InputMap::action_add_event); ObjectTypeDB::bind_method(_MD("action_has_event","action","event"),&InputMap::action_has_event); ObjectTypeDB::bind_method(_MD("action_erase_event","action","event"),&InputMap::action_erase_event); - ObjectTypeDB::bind_method(_MD("get_action_list","action"),&InputMap::get_action_list); + ObjectTypeDB::bind_method(_MD("get_action_list","action"),&InputMap::_get_action_list); ObjectTypeDB::bind_method(_MD("event_is_action","event","action"),&InputMap::event_is_action); ObjectTypeDB::bind_method(_MD("load_from_globals"),&InputMap::load_from_globals); @@ -162,6 +162,22 @@ void InputMap::action_erase_event(const StringName& p_action,const InputEvent& p } + +Array InputMap::_get_action_list(const StringName& p_action) { + + Array ret; + const List<InputEvent> *al = get_action_list(p_action); + if (al) { + for(List<InputEvent>::Element *E=al->front();E;E=E->next()) { + + ret.push_back(E->get());; + } + } + + return ret; + +} + const List<InputEvent> *InputMap::get_action_list(const StringName& p_action) { const Map<StringName, Action>::Element *E=input_map.find(p_action); |