List Physical Key before Key in the action map input editor
Physical Key should be used for most game inputs as it allows keys to work on non-QWERTY layouts out of the box. This is especially important for WASD movement layouts. In contrast, remapped (non-physical) keys are mainly useful in non-game applications, where shortcuts are expected to match a precise letter rather than a location on the keyboard.
This commit is contained in:
parent
f7fd5e3aeb
commit
f769e9a864
2 changed files with 12 additions and 7 deletions
|
@ -114,8 +114,13 @@ void ProjectSettingsEditor::_notification(int p_what) {
|
||||||
|
|
||||||
translation_list->connect("button_pressed", this, "_translation_delete");
|
translation_list->connect("button_pressed", this, "_translation_delete");
|
||||||
_update_actions();
|
_update_actions();
|
||||||
popup_add->add_icon_item(get_icon("Keyboard", "EditorIcons"), TTR("Key "), INPUT_KEY); //"Key " - because the word 'key' has already been used as a key animation
|
|
||||||
|
// List Physical Key before Key to encourage its use.
|
||||||
|
// Physical Key should be used for most game inputs as it allows keys to work
|
||||||
|
// on non-QWERTY layouts out of the box.
|
||||||
|
// This is especially important for WASD movement layouts.
|
||||||
popup_add->add_icon_item(get_icon("KeyboardPhysical", "EditorIcons"), TTR("Physical Key"), INPUT_KEY_PHYSICAL);
|
popup_add->add_icon_item(get_icon("KeyboardPhysical", "EditorIcons"), TTR("Physical Key"), INPUT_KEY_PHYSICAL);
|
||||||
|
popup_add->add_icon_item(get_icon("Keyboard", "EditorIcons"), TTR("Key "), INPUT_KEY); //"Key " - because the word 'key' has already been used as a key animation
|
||||||
popup_add->add_icon_item(get_icon("JoyButton", "EditorIcons"), TTR("Joy Button"), INPUT_JOY_BUTTON);
|
popup_add->add_icon_item(get_icon("JoyButton", "EditorIcons"), TTR("Joy Button"), INPUT_JOY_BUTTON);
|
||||||
popup_add->add_icon_item(get_icon("JoyAxis", "EditorIcons"), TTR("Joy Axis"), INPUT_JOY_MOTION);
|
popup_add->add_icon_item(get_icon("JoyAxis", "EditorIcons"), TTR("Joy Axis"), INPUT_JOY_MOTION);
|
||||||
popup_add->add_icon_item(get_icon("Mouse", "EditorIcons"), TTR("Mouse Button"), INPUT_MOUSE_BUTTON);
|
popup_add->add_icon_item(get_icon("Mouse", "EditorIcons"), TTR("Mouse Button"), INPUT_MOUSE_BUTTON);
|
||||||
|
@ -148,8 +153,8 @@ void ProjectSettingsEditor::_notification(int p_what) {
|
||||||
search_box->set_right_icon(get_icon("Search", "EditorIcons"));
|
search_box->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||||
search_box->set_clear_button_enabled(true);
|
search_box->set_clear_button_enabled(true);
|
||||||
action_add_error->add_color_override("font_color", get_color("error_color", "Editor"));
|
action_add_error->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY), get_icon("Keyboard", "EditorIcons"));
|
|
||||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY_PHYSICAL), get_icon("KeyboardPhysical", "EditorIcons"));
|
popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY_PHYSICAL), get_icon("KeyboardPhysical", "EditorIcons"));
|
||||||
|
popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY), get_icon("Keyboard", "EditorIcons"));
|
||||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_BUTTON), get_icon("JoyButton", "EditorIcons"));
|
popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_BUTTON), get_icon("JoyButton", "EditorIcons"));
|
||||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_MOTION), get_icon("JoyAxis", "EditorIcons"));
|
popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_MOTION), get_icon("JoyAxis", "EditorIcons"));
|
||||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_MOUSE_BUTTON), get_icon("Mouse", "EditorIcons"));
|
popup_add->set_item_icon(popup_add->get_item_index(INPUT_MOUSE_BUTTON), get_icon("Mouse", "EditorIcons"));
|
||||||
|
@ -472,16 +477,16 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
|
||||||
add_type = InputType(p_item);
|
add_type = InputType(p_item);
|
||||||
|
|
||||||
switch (add_type) {
|
switch (add_type) {
|
||||||
case INPUT_KEY: {
|
case INPUT_KEY_PHYSICAL: {
|
||||||
press_a_key_physical = false;
|
press_a_key_physical = true;
|
||||||
press_a_key_label->set_text(TTR("Press a Key..."));
|
press_a_key_label->set_text(TTR("Press a Key..."));
|
||||||
press_a_key->get_ok()->set_disabled(true);
|
press_a_key->get_ok()->set_disabled(true);
|
||||||
last_wait_for_key = Ref<InputEvent>();
|
last_wait_for_key = Ref<InputEvent>();
|
||||||
press_a_key->popup_centered(Size2(250, 80) * EDSCALE);
|
press_a_key->popup_centered(Size2(250, 80) * EDSCALE);
|
||||||
press_a_key->grab_focus();
|
press_a_key->grab_focus();
|
||||||
} break;
|
} break;
|
||||||
case INPUT_KEY_PHYSICAL: {
|
case INPUT_KEY: {
|
||||||
press_a_key_physical = true;
|
press_a_key_physical = false;
|
||||||
press_a_key_label->set_text(TTR("Press a Key..."));
|
press_a_key_label->set_text(TTR("Press a Key..."));
|
||||||
press_a_key->get_ok()->set_disabled(true);
|
press_a_key->get_ok()->set_disabled(true);
|
||||||
last_wait_for_key = Ref<InputEvent>();
|
last_wait_for_key = Ref<InputEvent>();
|
||||||
|
|
|
@ -44,8 +44,8 @@ class ProjectSettingsEditor : public AcceptDialog {
|
||||||
GDCLASS(ProjectSettingsEditor, AcceptDialog);
|
GDCLASS(ProjectSettingsEditor, AcceptDialog);
|
||||||
|
|
||||||
enum InputType {
|
enum InputType {
|
||||||
INPUT_KEY,
|
|
||||||
INPUT_KEY_PHYSICAL,
|
INPUT_KEY_PHYSICAL,
|
||||||
|
INPUT_KEY,
|
||||||
INPUT_JOY_BUTTON,
|
INPUT_JOY_BUTTON,
|
||||||
INPUT_JOY_MOTION,
|
INPUT_JOY_MOTION,
|
||||||
INPUT_MOUSE_BUTTON
|
INPUT_MOUSE_BUTTON
|
||||||
|
|
Loading…
Reference in a new issue