summaryrefslogtreecommitdiff
path: root/core/input_map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/input_map.cpp')
-rw-r--r--core/input_map.cpp22
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);
}