diff options
author | Anton Yabchinskiy <arn@bestmx.ru> | 2015-07-29 23:01:36 +0300 |
---|---|---|
committer | Anton Yabchinskiy <arn@bestmx.ru> | 2015-07-29 23:01:36 +0300 |
commit | dc8df8a91a995796f0f330bf6bb6b209f6dfce08 (patch) | |
tree | 46cfe09124703b07860754d6b44e0289422e0573 /core/input_map.cpp | |
parent | 16746f157f83d666079ba3266acec13d35b84c3f (diff) | |
parent | 922356b903061cda7591090bf19e8346c3a78cf5 (diff) |
Merge branch 'master' of github.com:okamstudio/godot
Diffstat (limited to 'core/input_map.cpp')
-rw-r--r-- | core/input_map.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/core/input_map.cpp b/core/input_map.cpp index 9426b0568e..24151c59c9 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -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(const 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); @@ -176,7 +192,7 @@ bool InputMap::event_is_action(const InputEvent& p_event, const StringName& p_ac Map<StringName,Action >::Element *E=input_map.find(p_action); if(!E) { - ERR_EXPLAIN("Request for unexisting InputMap action: "+String(p_action)); + ERR_EXPLAIN("Request for nonexistent InputMap action: "+String(p_action)); ERR_FAIL_COND_V(!E,false); } |