diff options
Diffstat (limited to 'main/input_default.cpp')
-rw-r--r-- | main/input_default.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp index 60675f1115..a13ddeb2b6 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -727,9 +727,17 @@ InputDefault::InputDefault() { fallback_mapping = -1; + // Parse default mappings. + { + int i = 0; + while (DefaultControllerMappings::mappings[i]) { + parse_mapping(DefaultControllerMappings::mappings[i++]); + } + } + + // If defined, parse SDL_GAMECONTROLLERCONFIG for possible new mappings/overrides. String env_mapping = OS::get_singleton()->get_environment("SDL_GAMECONTROLLERCONFIG"); if (env_mapping != "") { - Vector<String> entries = env_mapping.split("\n"); for (int i = 0; i < entries.size(); i++) { if (entries[i] == "") @@ -737,12 +745,6 @@ InputDefault::InputDefault() { parse_mapping(entries[i]); } } - - int i = 0; - while (DefaultControllerMappings::mappings[i]) { - - parse_mapping(DefaultControllerMappings::mappings[i++]); - } } void InputDefault::joy_button(int p_device, int p_button, bool p_pressed) { |