Fixes initialization of action list

This commit is contained in:
groud 2018-08-14 18:44:22 +02:00
parent ccce161d0e
commit 6ccf3d887c
1 changed files with 89 additions and 48 deletions

View File

@ -953,7 +953,8 @@ ProjectSettings::ProjectSettings() {
disable_feature_overrides = false; disable_feature_overrides = false;
registering_order = true; registering_order = true;
Array va; Array events;
Dictionary action;
Ref<InputEventKey> key; Ref<InputEventKey> key;
Ref<InputEventJoypadButton> joyb; Ref<InputEventJoypadButton> joyb;
@ -965,122 +966,162 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF("application/config/use_custom_user_dir", false); GLOBAL_DEF("application/config/use_custom_user_dir", false);
GLOBAL_DEF("application/config/custom_user_dir_name", ""); GLOBAL_DEF("application/config/custom_user_dir_name", "");
action = Dictionary();
action["deadzone"] = Variant(0.5f);
events = Array();
key.instance(); key.instance();
key->set_scancode(KEY_ENTER); key->set_scancode(KEY_ENTER);
va.push_back(key); events.push_back(key);
key.instance(); key.instance();
key->set_scancode(KEY_KP_ENTER); key->set_scancode(KEY_KP_ENTER);
va.push_back(key); events.push_back(key);
key.instance(); key.instance();
key->set_scancode(KEY_SPACE); key->set_scancode(KEY_SPACE);
va.push_back(key); events.push_back(key);
joyb.instance(); joyb.instance();
joyb->set_button_index(JOY_BUTTON_0); joyb->set_button_index(JOY_BUTTON_0);
va.push_back(joyb); events.push_back(joyb);
GLOBAL_DEF("input/ui_accept", va); action["events"] = events;
GLOBAL_DEF("input/ui_accept", action);
input_presets.push_back("input/ui_accept"); input_presets.push_back("input/ui_accept");
va = Array(); action = Dictionary();
action["deadzone"] = Variant(0.5f);
events = Array();
key.instance(); key.instance();
key->set_scancode(KEY_SPACE); key->set_scancode(KEY_SPACE);
va.push_back(key); events.push_back(key);
joyb.instance(); joyb.instance();
joyb->set_button_index(JOY_BUTTON_3); joyb->set_button_index(JOY_BUTTON_3);
va.push_back(joyb); events.push_back(joyb);
GLOBAL_DEF("input/ui_select", va); action["events"] = events;
GLOBAL_DEF("input/ui_select", action);
input_presets.push_back("input/ui_select"); input_presets.push_back("input/ui_select");
va = Array(); action = Dictionary();
action["deadzone"] = Variant(0.5f);
events = Array();
key.instance(); key.instance();
key->set_scancode(KEY_ESCAPE); key->set_scancode(KEY_ESCAPE);
va.push_back(key); events.push_back(key);
joyb.instance(); joyb.instance();
joyb->set_button_index(JOY_BUTTON_1); joyb->set_button_index(JOY_BUTTON_1);
va.push_back(joyb); events.push_back(joyb);
GLOBAL_DEF("input/ui_cancel", va); action["events"] = events;
GLOBAL_DEF("input/ui_cancel", action);
input_presets.push_back("input/ui_cancel"); input_presets.push_back("input/ui_cancel");
va = Array(); action = Dictionary();
action["deadzone"] = Variant(0.5f);
events = Array();
key.instance(); key.instance();
key->set_scancode(KEY_TAB); key->set_scancode(KEY_TAB);
va.push_back(key); events.push_back(key);
GLOBAL_DEF("input/ui_focus_next", va); action["events"] = events;
GLOBAL_DEF("input/ui_focus_next", action);
input_presets.push_back("input/ui_focus_next"); input_presets.push_back("input/ui_focus_next");
va = Array(); action = Dictionary();
action["deadzone"] = Variant(0.5f);
events = Array();
key.instance(); key.instance();
key->set_scancode(KEY_TAB); key->set_scancode(KEY_TAB);
key->set_shift(true); key->set_shift(true);
va.push_back(key); events.push_back(key);
GLOBAL_DEF("input/ui_focus_prev", va); action["events"] = events;
GLOBAL_DEF("input/ui_focus_prev", action);
input_presets.push_back("input/ui_focus_prev"); input_presets.push_back("input/ui_focus_prev");
va = Array(); action = Dictionary();
action["deadzone"] = Variant(0.5f);
events = Array();
key.instance(); key.instance();
key->set_scancode(KEY_LEFT); key->set_scancode(KEY_LEFT);
va.push_back(key); events.push_back(key);
joyb.instance(); joyb.instance();
joyb->set_button_index(JOY_DPAD_LEFT); joyb->set_button_index(JOY_DPAD_LEFT);
va.push_back(joyb); events.push_back(joyb);
GLOBAL_DEF("input/ui_left", va); action["events"] = events;
GLOBAL_DEF("input/ui_left", action);
input_presets.push_back("input/ui_left"); input_presets.push_back("input/ui_left");
va = Array(); action = Dictionary();
action["deadzone"] = Variant(0.5f);
events = Array();
key.instance(); key.instance();
key->set_scancode(KEY_RIGHT); key->set_scancode(KEY_RIGHT);
va.push_back(key); events.push_back(key);
joyb.instance(); joyb.instance();
joyb->set_button_index(JOY_DPAD_RIGHT); joyb->set_button_index(JOY_DPAD_RIGHT);
va.push_back(joyb); events.push_back(joyb);
GLOBAL_DEF("input/ui_right", va); action["events"] = events;
GLOBAL_DEF("input/ui_right", action);
input_presets.push_back("input/ui_right"); input_presets.push_back("input/ui_right");
va = Array(); action = Dictionary();
action["deadzone"] = Variant(0.5f);
events = Array();
key.instance(); key.instance();
key->set_scancode(KEY_UP); key->set_scancode(KEY_UP);
va.push_back(key); events.push_back(key);
joyb.instance(); joyb.instance();
joyb->set_button_index(JOY_DPAD_UP); joyb->set_button_index(JOY_DPAD_UP);
va.push_back(joyb); events.push_back(joyb);
GLOBAL_DEF("input/ui_up", va); action["events"] = events;
GLOBAL_DEF("input/ui_up", action);
input_presets.push_back("input/ui_up"); input_presets.push_back("input/ui_up");
va = Array(); action = Dictionary();
action["deadzone"] = Variant(0.5f);
events = Array();
key.instance(); key.instance();
key->set_scancode(KEY_DOWN); key->set_scancode(KEY_DOWN);
va.push_back(key); events.push_back(key);
joyb.instance(); joyb.instance();
joyb->set_button_index(JOY_DPAD_DOWN); joyb->set_button_index(JOY_DPAD_DOWN);
va.push_back(joyb); events.push_back(joyb);
GLOBAL_DEF("input/ui_down", va); action["events"] = events;
GLOBAL_DEF("input/ui_down", action);
input_presets.push_back("input/ui_down"); input_presets.push_back("input/ui_down");
va = Array(); action = Dictionary();
action["deadzone"] = Variant(0.5f);
events = Array();
key.instance(); key.instance();
key->set_scancode(KEY_PAGEUP); key->set_scancode(KEY_PAGEUP);
va.push_back(key); events.push_back(key);
GLOBAL_DEF("input/ui_page_up", va); action["events"] = events;
GLOBAL_DEF("input/ui_page_up", action);
input_presets.push_back("input/ui_page_up"); input_presets.push_back("input/ui_page_up");
va = Array(); action = Dictionary();
action["deadzone"] = Variant(0.5f);
events = Array();
key.instance(); key.instance();
key->set_scancode(KEY_PAGEDOWN); key->set_scancode(KEY_PAGEDOWN);
va.push_back(key); events.push_back(key);
GLOBAL_DEF("input/ui_page_down", va); action["events"] = events;
GLOBAL_DEF("input/ui_page_down", action);
input_presets.push_back("input/ui_page_down"); input_presets.push_back("input/ui_page_down");
va = Array(); action = Dictionary();
action["deadzone"] = Variant(0.5f);
events = Array();
key.instance(); key.instance();
key->set_scancode(KEY_HOME); key->set_scancode(KEY_HOME);
va.push_back(key); events.push_back(key);
GLOBAL_DEF("input/ui_home", va); action["events"] = events;
GLOBAL_DEF("input/ui_home", action);
input_presets.push_back("input/ui_home"); input_presets.push_back("input/ui_home");
va = Array(); action = Dictionary();
action["deadzone"] = Variant(0.5f);
events = Array();
key.instance(); key.instance();
key->set_scancode(KEY_END); key->set_scancode(KEY_END);
va.push_back(key); events.push_back(key);
GLOBAL_DEF("input/ui_end", va); action["events"] = events;
GLOBAL_DEF("input/ui_end", action);
input_presets.push_back("input/ui_end"); input_presets.push_back("input/ui_end");
//GLOBAL_DEF("display/window/handheld/orientation", "landscape"); //GLOBAL_DEF("display/window/handheld/orientation", "landscape");