diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-05-18 10:20:54 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-05-18 10:20:54 -0300 |
commit | e323cc050564fdb1b5cf81793d173cbd9483f55a (patch) | |
tree | a8355abfbd7d1d096749777d11f9fa753ed50d6e /core/input_map.cpp | |
parent | 5272853cdc1c37fc545c443370bf87642122f4cc (diff) | |
download | redot-engine-e323cc050564fdb1b5cf81793d173cbd9483f55a.tar.gz |
-Rename unexisting by nonexistant, closes #1940
-Added function to retrieve list of actions fron InputMap
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); |