gd: added input addon

This commit is contained in:
2025-05-27 19:20:46 +02:00
parent d8a1604af9
commit c8d8c7ec25
683 changed files with 21608 additions and 2 deletions

View File

@ -0,0 +1,147 @@
[gd_resource type="Resource" script_class="GUIDEMappingContext" load_steps=33 format=3 uid="uid://dubuepcs1w17f"]
[ext_resource type="Resource" uid="uid://bohjda85owgnc" path="res://guide_examples/remapping/mapping_contexts/controller_actions/ui_accept.tres" id="1_rokdq"]
[ext_resource type="Script" path="res://addons/guide/inputs/guide_input_joy_button.gd" id="2_30snk"]
[ext_resource type="Script" path="res://addons/guide/guide_input_mapping.gd" id="3_ifcmr"]
[ext_resource type="Script" path="res://addons/guide/triggers/guide_trigger_pressed.gd" id="4_bn4su"]
[ext_resource type="Script" path="res://addons/guide/guide_action_mapping.gd" id="5_wtinc"]
[ext_resource type="Resource" uid="uid://bcum2m26we6ct" path="res://guide_examples/remapping/mapping_contexts/shared_actions/close_menu.tres" id="6_mbh1l"]
[ext_resource type="Resource" uid="uid://ce3ytxn2tcxxe" path="res://guide_examples/remapping/mapping_contexts/controller_actions/switch_to_keyboard.tres" id="7_e2y7c"]
[ext_resource type="Script" path="res://addons/guide/triggers/guide_trigger_released.gd" id="7_ofh8l"]
[ext_resource type="Script" path="res://addons/guide/inputs/guide_input_any.gd" id="8_qiw4m"]
[ext_resource type="Script" path="res://addons/guide/guide_mapping_context.gd" id="9_rcbwk"]
[ext_resource type="Resource" uid="uid://dg1or0do0s1ad" path="res://guide_examples/remapping/mapping_contexts/controller_actions/next_tab.tres" id="10_5tveu"]
[ext_resource type="Resource" uid="uid://cfrx54l1vmjey" path="res://guide_examples/remapping/mapping_contexts/controller_actions/previous_tab.tres" id="11_iu0wm"]
[sub_resource type="Resource" id="Resource_uri0r"]
script = ExtResource("2_30snk")
button = 0
joy_index = 0
[sub_resource type="Resource" id="Resource_i518v"]
script = ExtResource("7_ofh8l")
actuation_threshold = 0.5
[sub_resource type="Resource" id="Resource_kpld2"]
script = ExtResource("3_ifcmr")
override_action_settings = false
is_remappable = false
display_name = ""
display_category = ""
input = SubResource("Resource_uri0r")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([SubResource("Resource_i518v")])
[sub_resource type="Resource" id="Resource_33xax"]
script = ExtResource("5_wtinc")
action = ExtResource("1_rokdq")
input_mappings = Array[ExtResource("3_ifcmr")]([SubResource("Resource_kpld2")])
[sub_resource type="Resource" id="Resource_lu1fr"]
script = ExtResource("2_30snk")
button = 6
joy_index = 0
[sub_resource type="Resource" id="Resource_oikmn"]
script = ExtResource("7_ofh8l")
actuation_threshold = 0.5
[sub_resource type="Resource" id="Resource_lju6e"]
script = ExtResource("3_ifcmr")
override_action_settings = false
is_remappable = false
display_name = ""
display_category = ""
input = SubResource("Resource_lu1fr")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([SubResource("Resource_oikmn")])
[sub_resource type="Resource" id="Resource_djru6"]
script = ExtResource("5_wtinc")
action = ExtResource("6_mbh1l")
input_mappings = Array[ExtResource("3_ifcmr")]([SubResource("Resource_lju6e")])
[sub_resource type="Resource" id="Resource_mc0ue"]
script = ExtResource("8_qiw4m")
mouse_buttons = true
mouse_movement = false
minimum_mouse_movement_distance = 1.0
joy_buttons = false
joy_axes = false
minimum_joy_axis_actuation_strength = 0.2
keyboard = true
touch = false
mouse = true
joy = false
[sub_resource type="Resource" id="Resource_vsgae"]
script = ExtResource("4_bn4su")
actuation_threshold = 0.5
[sub_resource type="Resource" id="Resource_vwjgy"]
script = ExtResource("3_ifcmr")
override_action_settings = false
is_remappable = false
display_name = ""
display_category = ""
input = SubResource("Resource_mc0ue")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([SubResource("Resource_vsgae")])
[sub_resource type="Resource" id="Resource_38x5y"]
script = ExtResource("5_wtinc")
action = ExtResource("7_e2y7c")
input_mappings = Array[ExtResource("3_ifcmr")]([SubResource("Resource_vwjgy")])
[sub_resource type="Resource" id="Resource_sudy1"]
script = ExtResource("2_30snk")
button = 10
joy_index = 0
[sub_resource type="Resource" id="Resource_4j53a"]
script = ExtResource("4_bn4su")
actuation_threshold = 0.5
[sub_resource type="Resource" id="Resource_1g85d"]
script = ExtResource("3_ifcmr")
override_action_settings = false
is_remappable = false
display_name = ""
display_category = ""
input = SubResource("Resource_sudy1")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([SubResource("Resource_4j53a")])
[sub_resource type="Resource" id="Resource_qsusb"]
script = ExtResource("5_wtinc")
action = ExtResource("10_5tveu")
input_mappings = Array[ExtResource("3_ifcmr")]([SubResource("Resource_1g85d")])
[sub_resource type="Resource" id="Resource_dkk46"]
script = ExtResource("2_30snk")
button = 9
joy_index = 0
[sub_resource type="Resource" id="Resource_taj0d"]
script = ExtResource("4_bn4su")
actuation_threshold = 0.5
[sub_resource type="Resource" id="Resource_35h1x"]
script = ExtResource("3_ifcmr")
override_action_settings = false
is_remappable = false
display_name = ""
display_category = ""
input = SubResource("Resource_dkk46")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([SubResource("Resource_taj0d")])
[sub_resource type="Resource" id="Resource_rl360"]
script = ExtResource("5_wtinc")
action = ExtResource("11_iu0wm")
input_mappings = Array[ExtResource("3_ifcmr")]([SubResource("Resource_35h1x")])
[resource]
script = ExtResource("9_rcbwk")
display_name = ""
mappings = Array[ExtResource("5_wtinc")]([SubResource("Resource_33xax"), SubResource("Resource_djru6"), SubResource("Resource_38x5y"), SubResource("Resource_qsusb"), SubResource("Resource_rl360")])

View File

@ -0,0 +1,76 @@
[gd_resource type="Resource" script_class="GUIDEMappingContext" load_steps=18 format=3 uid="uid://bqd45wwsetlyg"]
[ext_resource type="Resource" uid="uid://bcum2m26we6ct" path="res://guide_examples/remapping/mapping_contexts/shared_actions/close_menu.tres" id="1_j25bp"]
[ext_resource type="Script" path="res://addons/guide/inputs/guide_input_key.gd" id="2_a3vaw"]
[ext_resource type="Script" path="res://addons/guide/guide_input_mapping.gd" id="3_n037t"]
[ext_resource type="Script" path="res://addons/guide/triggers/guide_trigger_released.gd" id="4_008yb"]
[ext_resource type="Script" path="res://addons/guide/triggers/guide_trigger_pressed.gd" id="4_t70fr"]
[ext_resource type="Script" path="res://addons/guide/guide_action_mapping.gd" id="5_xuekb"]
[ext_resource type="Resource" uid="uid://3vqfs786vcsa" path="res://guide_examples/remapping/mapping_contexts/keyboard_actions/switch_to_controller.tres" id="6_lkk3b"]
[ext_resource type="Script" path="res://addons/guide/guide_mapping_context.gd" id="6_rsvyd"]
[ext_resource type="Script" path="res://addons/guide/inputs/guide_input_any.gd" id="7_b4hkn"]
[sub_resource type="Resource" id="Resource_rqm6k"]
script = ExtResource("2_a3vaw")
key = 4194305
shift = false
control = false
alt = false
meta = false
allow_additional_modifiers = true
[sub_resource type="Resource" id="Resource_yfr8v"]
script = ExtResource("4_008yb")
actuation_threshold = 0.5
[sub_resource type="Resource" id="Resource_lju6e"]
script = ExtResource("3_n037t")
override_action_settings = false
is_remappable = false
display_name = ""
display_category = ""
input = SubResource("Resource_rqm6k")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([SubResource("Resource_yfr8v")])
[sub_resource type="Resource" id="Resource_djru6"]
script = ExtResource("5_xuekb")
action = ExtResource("1_j25bp")
input_mappings = Array[ExtResource("3_n037t")]([SubResource("Resource_lju6e")])
[sub_resource type="Resource" id="Resource_mpqi8"]
script = ExtResource("7_b4hkn")
mouse_buttons = false
mouse_movement = false
minimum_mouse_movement_distance = 1.0
joy_buttons = true
joy_axes = false
minimum_joy_axis_actuation_strength = 0.2
keyboard = false
touch = false
mouse = false
joy = true
[sub_resource type="Resource" id="Resource_4apa3"]
script = ExtResource("4_t70fr")
actuation_threshold = 0.5
[sub_resource type="Resource" id="Resource_0hgmj"]
script = ExtResource("3_n037t")
override_action_settings = false
is_remappable = false
display_name = ""
display_category = ""
input = SubResource("Resource_mpqi8")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([SubResource("Resource_4apa3")])
[sub_resource type="Resource" id="Resource_2neno"]
script = ExtResource("5_xuekb")
action = ExtResource("6_lkk3b")
input_mappings = Array[ExtResource("3_n037t")]([SubResource("Resource_0hgmj")])
[resource]
script = ExtResource("6_rsvyd")
display_name = ""
mappings = Array[ExtResource("5_xuekb")]([SubResource("Resource_djru6"), SubResource("Resource_2neno")])

View File

@ -0,0 +1,127 @@
[gd_resource type="Resource" script_class="GUIDEMappingContext" load_steps=31 format=3 uid="uid://bexjevffjsh3i"]
[ext_resource type="Resource" uid="uid://chhw5umkd1j2p" path="res://guide_examples/remapping/mapping_contexts/shared_actions/player_movement_2d.tres" id="1_78yyx"]
[ext_resource type="Script" path="res://addons/guide/guide_mapping_context.gd" id="1_l4253"]
[ext_resource type="Script" path="res://addons/guide/modifiers/guide_modifier_deadzone.gd" id="3_rbwxh"]
[ext_resource type="Script" path="res://addons/guide/guide_input_mapping.gd" id="4_m37gr"]
[ext_resource type="Resource" uid="uid://qikyr1rgxw2l" path="res://guide_examples/remapping/mapping_contexts/controller_actions/player_movement_stick_invert.tres" id="4_qbgwt"]
[ext_resource type="Script" path="res://addons/guide/guide_action_mapping.gd" id="5_167oa"]
[ext_resource type="Script" path="res://addons/guide/inputs/guide_input_joy_axis_2d.gd" id="6_y041f"]
[ext_resource type="Resource" uid="uid://ce3ytxn2tcxxe" path="res://guide_examples/remapping/mapping_contexts/controller_actions/switch_to_keyboard.tres" id="8_4d4ov"]
[ext_resource type="Script" path="res://addons/guide/inputs/guide_input_any.gd" id="9_0d1uf"]
[ext_resource type="Script" path="res://addons/guide/triggers/guide_trigger_released.gd" id="9_eexjp"]
[ext_resource type="Resource" uid="uid://c65tsmp268vdq" path="res://guide_examples/remapping/mapping_contexts/shared_actions/open_menu.tres" id="9_l4c4j"]
[ext_resource type="Resource" uid="uid://b1iaet1m2gi2e" path="res://guide_examples/remapping/mapping_contexts/shared_actions/fire.tres" id="9_tkveh"]
[ext_resource type="Script" path="res://addons/guide/inputs/guide_input_joy_button.gd" id="10_a30o8"]
[ext_resource type="Script" path="res://addons/guide/triggers/guide_trigger_pressed.gd" id="11_avbpy"]
[sub_resource type="Resource" id="Resource_nr3w6"]
script = ExtResource("6_y041f")
x = 0
y = 1
joy_index = -1
[sub_resource type="Resource" id="Resource_towa1"]
script = ExtResource("3_rbwxh")
lower_threshold = 0.2
upper_threshold = 1.0
[sub_resource type="Resource" id="Resource_gpn8l"]
script = ExtResource("4_m37gr")
override_action_settings = false
is_remappable = false
display_name = ""
display_category = ""
input = SubResource("Resource_nr3w6")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([SubResource("Resource_towa1"), ExtResource("4_qbgwt")])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([])
[sub_resource type="Resource" id="Resource_6h1my"]
script = ExtResource("5_167oa")
action = ExtResource("1_78yyx")
input_mappings = Array[ExtResource("4_m37gr")]([SubResource("Resource_gpn8l")])
[sub_resource type="Resource" id="Resource_p73kx"]
script = ExtResource("10_a30o8")
button = 6
joy_index = -1
[sub_resource type="Resource" id="Resource_uov21"]
script = ExtResource("9_eexjp")
actuation_threshold = 0.5
[sub_resource type="Resource" id="Resource_f4p62"]
script = ExtResource("4_m37gr")
override_action_settings = false
is_remappable = false
display_name = ""
display_category = ""
input = SubResource("Resource_p73kx")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([SubResource("Resource_uov21")])
[sub_resource type="Resource" id="Resource_wa31m"]
script = ExtResource("5_167oa")
action = ExtResource("9_l4c4j")
input_mappings = Array[ExtResource("4_m37gr")]([SubResource("Resource_f4p62")])
[sub_resource type="Resource" id="Resource_iwnk1"]
script = ExtResource("9_0d1uf")
mouse_buttons = false
mouse_movement = false
minimum_mouse_movement_distance = 1.0
joy_buttons = false
joy_axes = false
minimum_joy_axis_actuation_strength = 0.2
keyboard = true
touch = false
mouse = false
joy = false
[sub_resource type="Resource" id="Resource_jwpon"]
script = ExtResource("11_avbpy")
actuation_threshold = 0.5
[sub_resource type="Resource" id="Resource_limxc"]
script = ExtResource("4_m37gr")
override_action_settings = false
is_remappable = false
display_name = ""
display_category = ""
input = SubResource("Resource_iwnk1")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([SubResource("Resource_jwpon")])
[sub_resource type="Resource" id="Resource_rtwk8"]
script = ExtResource("5_167oa")
action = ExtResource("8_4d4ov")
input_mappings = Array[ExtResource("4_m37gr")]([SubResource("Resource_limxc")])
[sub_resource type="Resource" id="Resource_tsvy3"]
script = ExtResource("10_a30o8")
button = 0
joy_index = -1
[sub_resource type="Resource" id="Resource_qvmci"]
script = ExtResource("11_avbpy")
actuation_threshold = 0.5
[sub_resource type="Resource" id="Resource_hf22v"]
script = ExtResource("4_m37gr")
override_action_settings = false
is_remappable = false
display_name = ""
display_category = ""
input = SubResource("Resource_tsvy3")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([SubResource("Resource_qvmci")])
[sub_resource type="Resource" id="Resource_t70e5"]
script = ExtResource("5_167oa")
action = ExtResource("9_tkveh")
input_mappings = Array[ExtResource("4_m37gr")]([SubResource("Resource_hf22v")])
[resource]
script = ExtResource("1_l4253")
display_name = ""
mappings = Array[ExtResource("5_167oa")]([SubResource("Resource_6h1my"), SubResource("Resource_wa31m"), SubResource("Resource_rtwk8"), SubResource("Resource_t70e5")])

View File

@ -0,0 +1,13 @@
[gd_resource type="Resource" script_class="GUIDEAction" load_steps=2 format=3 uid="uid://dg1or0do0s1ad"]
[ext_resource type="Script" path="res://addons/guide/guide_action.gd" id="1_432ak"]
[resource]
script = ExtResource("1_432ak")
name = &""
action_value_type = 0
block_lower_priority_actions = true
emit_as_godot_actions = false
is_remappable = false
display_name = ""
display_category = ""

View File

@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="GUIDEModifierNegate" load_steps=2 format=3 uid="uid://qikyr1rgxw2l"]
[ext_resource type="Script" path="res://addons/guide/modifiers/guide_modifier_negate.gd" id="1_geiqh"]
[resource]
script = ExtResource("1_geiqh")
x = false
y = false
z = false

View File

@ -0,0 +1,13 @@
[gd_resource type="Resource" script_class="GUIDEAction" load_steps=2 format=3 uid="uid://cfrx54l1vmjey"]
[ext_resource type="Script" path="res://addons/guide/guide_action.gd" id="1_mbx72"]
[resource]
script = ExtResource("1_mbx72")
name = &""
action_value_type = 0
block_lower_priority_actions = true
emit_as_godot_actions = false
is_remappable = false
display_name = ""
display_category = ""

View File

@ -0,0 +1,13 @@
[gd_resource type="Resource" script_class="GUIDEAction" load_steps=2 format=3 uid="uid://ce3ytxn2tcxxe"]
[ext_resource type="Script" path="res://addons/guide/guide_action.gd" id="1_gwq63"]
[resource]
script = ExtResource("1_gwq63")
name = &""
action_value_type = 0
block_lower_priority_actions = true
emit_as_godot_actions = false
is_remappable = false
display_name = ""
display_category = ""

View File

@ -0,0 +1,13 @@
[gd_resource type="Resource" script_class="GUIDEAction" load_steps=2 format=3 uid="uid://bohjda85owgnc"]
[ext_resource type="Script" path="res://addons/guide/guide_action.gd" id="1_laec0"]
[resource]
script = ExtResource("1_laec0")
name = &"ui_accept"
action_value_type = 0
block_lower_priority_actions = true
emit_as_godot_actions = true
is_remappable = false
display_name = ""
display_category = ""

View File

@ -0,0 +1,208 @@
[gd_resource type="Resource" script_class="GUIDEMappingContext" load_steps=38 format=3 uid="uid://cu0dhstc00cj5"]
[ext_resource type="Resource" uid="uid://chhw5umkd1j2p" path="res://guide_examples/remapping/mapping_contexts/shared_actions/player_movement_2d.tres" id="1_uy1j0"]
[ext_resource type="Script" path="res://addons/guide/modifiers/guide_modifier_negate.gd" id="4_5oaiq"]
[ext_resource type="Script" path="res://addons/guide/guide_input_mapping.gd" id="5_d2nln"]
[ext_resource type="Script" path="res://addons/guide/modifiers/guide_modifier_input_swizzle.gd" id="8_vp516"]
[ext_resource type="Script" path="res://addons/guide/guide_action_mapping.gd" id="10_xpxg7"]
[ext_resource type="Script" path="res://addons/guide/inputs/guide_input_key.gd" id="12_msrvd"]
[ext_resource type="Script" path="res://addons/guide/triggers/guide_trigger_released.gd" id="13_11jxi"]
[ext_resource type="Resource" uid="uid://c65tsmp268vdq" path="res://guide_examples/remapping/mapping_contexts/shared_actions/open_menu.tres" id="13_m7li8"]
[ext_resource type="Resource" uid="uid://3vqfs786vcsa" path="res://guide_examples/remapping/mapping_contexts/keyboard_actions/switch_to_controller.tres" id="14_57mry"]
[ext_resource type="Script" path="res://addons/guide/triggers/guide_trigger_pressed.gd" id="14_gcar0"]
[ext_resource type="Resource" uid="uid://b1iaet1m2gi2e" path="res://guide_examples/remapping/mapping_contexts/shared_actions/fire.tres" id="15_7eor3"]
[ext_resource type="Script" path="res://addons/guide/inputs/guide_input_any.gd" id="15_51tw7"]
[ext_resource type="Script" path="res://addons/guide/guide_mapping_context.gd" id="15_qjsfb"]
[sub_resource type="Resource" id="Resource_d5vxv"]
script = ExtResource("12_msrvd")
key = 87
shift = false
control = false
alt = false
meta = false
allow_additional_modifiers = true
[sub_resource type="Resource" id="Resource_d5crb"]
script = ExtResource("8_vp516")
order = 0
[sub_resource type="Resource" id="Resource_cwfnu"]
script = ExtResource("4_5oaiq")
x = true
y = true
z = true
[sub_resource type="Resource" id="Resource_u7h55"]
script = ExtResource("5_d2nln")
override_action_settings = true
is_remappable = true
display_name = "Up"
display_category = ""
input = SubResource("Resource_d5vxv")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([SubResource("Resource_d5crb"), SubResource("Resource_cwfnu")])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([])
[sub_resource type="Resource" id="Resource_syl0m"]
script = ExtResource("12_msrvd")
key = 83
shift = false
control = false
alt = false
meta = false
allow_additional_modifiers = true
[sub_resource type="Resource" id="Resource_8rcpo"]
script = ExtResource("8_vp516")
order = 0
[sub_resource type="Resource" id="Resource_te6bu"]
script = ExtResource("5_d2nln")
override_action_settings = true
is_remappable = true
display_name = "Down"
display_category = ""
input = SubResource("Resource_syl0m")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([SubResource("Resource_8rcpo")])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([])
[sub_resource type="Resource" id="Resource_erj62"]
script = ExtResource("12_msrvd")
key = 65
shift = false
control = false
alt = false
meta = false
allow_additional_modifiers = true
[sub_resource type="Resource" id="Resource_84clu"]
script = ExtResource("4_5oaiq")
x = true
y = true
z = true
[sub_resource type="Resource" id="Resource_ho2kd"]
script = ExtResource("5_d2nln")
override_action_settings = true
is_remappable = true
display_name = "Left"
display_category = ""
input = SubResource("Resource_erj62")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([SubResource("Resource_84clu")])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([])
[sub_resource type="Resource" id="Resource_ybtim"]
script = ExtResource("12_msrvd")
key = 68
shift = false
control = false
alt = false
meta = false
allow_additional_modifiers = true
[sub_resource type="Resource" id="Resource_bnk54"]
script = ExtResource("5_d2nln")
override_action_settings = true
is_remappable = true
display_name = "Right"
display_category = ""
input = SubResource("Resource_ybtim")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([])
[sub_resource type="Resource" id="Resource_358t4"]
script = ExtResource("10_xpxg7")
action = ExtResource("1_uy1j0")
input_mappings = Array[ExtResource("5_d2nln")]([SubResource("Resource_u7h55"), SubResource("Resource_te6bu"), SubResource("Resource_ho2kd"), SubResource("Resource_bnk54")])
metadata/_guide_input_mappings_collapsed = false
[sub_resource type="Resource" id="Resource_la24a"]
script = ExtResource("12_msrvd")
key = 4194305
shift = false
control = false
alt = false
meta = false
allow_additional_modifiers = true
[sub_resource type="Resource" id="Resource_dbmrn"]
script = ExtResource("13_11jxi")
actuation_threshold = 0.5
[sub_resource type="Resource" id="Resource_wr8lq"]
script = ExtResource("5_d2nln")
override_action_settings = false
is_remappable = false
display_name = ""
display_category = ""
input = SubResource("Resource_la24a")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([SubResource("Resource_dbmrn")])
[sub_resource type="Resource" id="Resource_iwmfr"]
script = ExtResource("10_xpxg7")
action = ExtResource("13_m7li8")
input_mappings = Array[ExtResource("5_d2nln")]([SubResource("Resource_wr8lq")])
metadata/_guide_input_mappings_collapsed = false
[sub_resource type="Resource" id="Resource_ke2lc"]
script = ExtResource("15_51tw7")
mouse_buttons = false
mouse_movement = false
minimum_mouse_movement_distance = 1.0
joy_buttons = true
joy_axes = false
minimum_joy_axis_actuation_strength = 0.2
keyboard = false
touch = false
mouse = false
joy = true
[sub_resource type="Resource" id="Resource_oh8td"]
script = ExtResource("5_d2nln")
override_action_settings = false
is_remappable = false
display_name = ""
display_category = ""
input = SubResource("Resource_ke2lc")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([])
[sub_resource type="Resource" id="Resource_unkjf"]
script = ExtResource("10_xpxg7")
action = ExtResource("14_57mry")
input_mappings = Array[ExtResource("5_d2nln")]([SubResource("Resource_oh8td")])
[sub_resource type="Resource" id="Resource_h3p6j"]
script = ExtResource("12_msrvd")
key = 32
shift = false
control = false
alt = false
meta = false
allow_additional_modifiers = true
[sub_resource type="Resource" id="Resource_saax4"]
script = ExtResource("14_gcar0")
actuation_threshold = 0.5
[sub_resource type="Resource" id="Resource_nm3w5"]
script = ExtResource("5_d2nln")
override_action_settings = false
is_remappable = false
display_name = ""
display_category = ""
input = SubResource("Resource_h3p6j")
modifiers = Array[Resource("res://addons/guide/modifiers/guide_modifier.gd")]([])
triggers = Array[Resource("res://addons/guide/triggers/guide_trigger.gd")]([SubResource("Resource_saax4")])
[sub_resource type="Resource" id="Resource_cv74y"]
script = ExtResource("10_xpxg7")
action = ExtResource("15_7eor3")
input_mappings = Array[ExtResource("5_d2nln")]([SubResource("Resource_nm3w5")])
metadata/_guide_input_mappings_collapsed = false
[resource]
script = ExtResource("15_qjsfb")
display_name = "Keyboard and Mouse"
mappings = Array[ExtResource("10_xpxg7")]([SubResource("Resource_358t4"), SubResource("Resource_iwmfr"), SubResource("Resource_unkjf"), SubResource("Resource_cv74y")])

View File

@ -0,0 +1,13 @@
[gd_resource type="Resource" script_class="GUIDEAction" load_steps=2 format=3 uid="uid://3vqfs786vcsa"]
[ext_resource type="Script" path="res://addons/guide/guide_action.gd" id="1_ahfs1"]
[resource]
script = ExtResource("1_ahfs1")
name = &""
action_value_type = 0
block_lower_priority_actions = true
emit_as_godot_actions = false
is_remappable = false
display_name = ""
display_category = ""

View File

@ -0,0 +1,13 @@
[gd_resource type="Resource" script_class="GUIDEAction" load_steps=2 format=3 uid="uid://bcum2m26we6ct"]
[ext_resource type="Script" path="res://addons/guide/guide_action.gd" id="1_q87d1"]
[resource]
script = ExtResource("1_q87d1")
name = &""
action_value_type = 0
block_lower_priority_actions = true
emit_as_godot_actions = false
is_remappable = false
display_name = ""
display_category = ""

View File

@ -0,0 +1,13 @@
[gd_resource type="Resource" script_class="GUIDEAction" load_steps=2 format=3 uid="uid://b1iaet1m2gi2e"]
[ext_resource type="Script" path="res://addons/guide/guide_action.gd" id="1_d1iw0"]
[resource]
script = ExtResource("1_d1iw0")
name = &""
action_value_type = 0
block_lower_priority_actions = true
emit_as_godot_actions = false
is_remappable = true
display_name = "Fire"
display_category = "Player Actions"

View File

@ -0,0 +1,13 @@
[gd_resource type="Resource" script_class="GUIDEAction" load_steps=2 format=3 uid="uid://c65tsmp268vdq"]
[ext_resource type="Script" path="res://addons/guide/guide_action.gd" id="1_rdx5a"]
[resource]
script = ExtResource("1_rdx5a")
name = &""
action_value_type = 0
block_lower_priority_actions = true
emit_as_godot_actions = false
is_remappable = false
display_name = ""
display_category = ""

View File

@ -0,0 +1,13 @@
[gd_resource type="Resource" script_class="GUIDEAction" load_steps=2 format=3 uid="uid://chhw5umkd1j2p"]
[ext_resource type="Script" path="res://addons/guide/guide_action.gd" id="1_ecpj4"]
[resource]
script = ExtResource("1_ecpj4")
name = &""
action_value_type = 2
block_lower_priority_actions = true
emit_as_godot_actions = false
is_remappable = true
display_name = ""
display_category = "Player Actions"

View File

@ -0,0 +1,24 @@
## This is the player script. Note how it has no clue about controllers, axis inversion
## etc. This is all handled by GUIDE and the remapping dialog.
extends Node2D
@export var speed:float = 300
@export var move_action:GUIDEAction
@export var fire_action:GUIDEAction
@export var fireball_scene:PackedScene
func _ready():
fire_action.triggered.connect(_shoot_fireball)
func _process(delta:float) -> void:
position += move_action.value_axis_2d.normalized() * speed * delta
func _shoot_fireball():
var fireball = fireball_scene.instantiate()
fireball.direction = Vector2.UP
get_parent().add_child(fireball)
fireball.global_transform = global_transform

View File

@ -0,0 +1 @@
uid://bhn2nskt2cgym

View File

@ -0,0 +1,57 @@
## This is the main game controller. It enables a control scheme at the start and is
## responsible for controlling the remapping dialog.
extends Node
const Utils = preload("utils.gd")
@export_group("Context & Modifiers")
@export var keyboard:GUIDEMappingContext
@export var controller:GUIDEMappingContext
@export var controller_axis_invert_modifier:GUIDEModifierNegate
@export_group("Actions")
@export var switch_to_keyboard:GUIDEAction
@export var switch_to_controller:GUIDEAction
@export var open_menu:GUIDEAction
@onready var _remapping_dialog:Control = %RemappingDialog
func _ready():
# React when the open menu action is triggered.
open_menu.triggered.connect(_open_menu)
# and switching to controller / keyboard ...
switch_to_controller.triggered.connect(_switch.bind(controller))
switch_to_keyboard.triggered.connect(_switch.bind(keyboard))
# Also listen to when the remapping dialog closes and re-apply the changed
# mapping config
_remapping_dialog.closed.connect(_load_remapping_config)
# Start with the keyboard scheme
GUIDE.enable_mapping_context(keyboard)
# finally enable all controls with the last saved remapping configuration
_load_remapping_config(Utils.load_remapping_config())
func _open_menu() -> void:
# and show the remapping dialog
_remapping_dialog.open()
func _load_remapping_config(config:GUIDERemappingConfig):
GUIDE.set_remapping_config(config)
# also apply changes to our modifiers
controller_axis_invert_modifier.x = config.custom_data.get(Utils.CUSTOM_DATA_INVERT_HORIZONTAL, false)
controller_axis_invert_modifier.y = config.custom_data.get(Utils.CUSTOM_DATA_INVERT_VERTICAL, false)
func _switch(context:GUIDEMappingContext):
# ignore while remapping is active, remapping will take care of it
if _remapping_dialog.visible:
return
GUIDE.enable_mapping_context(context, true)

View File

@ -0,0 +1 @@
uid://ba5134rplb4y

View File

@ -0,0 +1,67 @@
[gd_scene load_steps=17 format=3 uid="uid://gjweqc0stfqh"]
[ext_resource type="Script" path="res://guide_examples/remapping/remapping.gd" id="1_3d1tp"]
[ext_resource type="Texture2D" uid="uid://byjxtsekdl8t2" path="res://guide_examples/shared/godot_logo.svg" id="1_gkmxq"]
[ext_resource type="Resource" uid="uid://qikyr1rgxw2l" path="res://guide_examples/remapping/mapping_contexts/controller_actions/player_movement_stick_invert.tres" id="2_3dav4"]
[ext_resource type="Resource" uid="uid://cu0dhstc00cj5" path="res://guide_examples/remapping/mapping_contexts/keyboard.tres" id="2_issuo"]
[ext_resource type="Script" path="res://guide_examples/remapping/player.gd" id="2_n3drv"]
[ext_resource type="Resource" uid="uid://bexjevffjsh3i" path="res://guide_examples/remapping/mapping_contexts/controller.tres" id="3_apwxt"]
[ext_resource type="Resource" uid="uid://c65tsmp268vdq" path="res://guide_examples/remapping/mapping_contexts/shared_actions/open_menu.tres" id="3_g1dlj"]
[ext_resource type="Resource" uid="uid://chhw5umkd1j2p" path="res://guide_examples/remapping/mapping_contexts/shared_actions/player_movement_2d.tres" id="4_07jn1"]
[ext_resource type="Resource" uid="uid://ce3ytxn2tcxxe" path="res://guide_examples/remapping/mapping_contexts/controller_actions/switch_to_keyboard.tres" id="5_aqwgr"]
[ext_resource type="PackedScene" uid="uid://dkr80d2pi0d41" path="res://addons/guide/debugger/guide_debugger.tscn" id="5_kdgir"]
[ext_resource type="Resource" uid="uid://b1iaet1m2gi2e" path="res://guide_examples/remapping/mapping_contexts/shared_actions/fire.tres" id="6_esnhm"]
[ext_resource type="Resource" uid="uid://3vqfs786vcsa" path="res://guide_examples/remapping/mapping_contexts/keyboard_actions/switch_to_controller.tres" id="6_jncg0"]
[ext_resource type="Theme" uid="uid://dot0gi1yoqmrl" path="res://guide_examples/shared/ui_theme.tres" id="7_8t2l7"]
[ext_resource type="PackedScene" uid="uid://bq0w7uaotgfct" path="res://guide_examples/remapping/ui/remapping_dialog.tscn" id="7_g0vxv"]
[ext_resource type="PackedScene" uid="uid://c36cnvgv2ur60" path="res://guide_examples/shared/fireball/fireball.tscn" id="7_w2y2e"]
[ext_resource type="Script" path="res://guide_examples/shared/instructions_label.gd" id="14_e0a18"]
[node name="Remapping" type="Node"]
script = ExtResource("1_3d1tp")
keyboard = ExtResource("2_issuo")
controller = ExtResource("3_apwxt")
controller_axis_invert_modifier = ExtResource("2_3dav4")
switch_to_keyboard = ExtResource("5_aqwgr")
switch_to_controller = ExtResource("6_jncg0")
open_menu = ExtResource("3_g1dlj")
[node name="Player" type="Sprite2D" parent="."]
position = Vector2(546, 317)
texture = ExtResource("1_gkmxq")
script = ExtResource("2_n3drv")
move_action = ExtResource("4_07jn1")
fire_action = ExtResource("6_esnhm")
fireball_scene = ExtResource("7_w2y2e")
[node name="HUD Layer" type="CanvasLayer" parent="."]
[node name="Label" type="RichTextLabel" parent="HUD Layer"]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -16.0
offset_top = 12.0
offset_right = -15.0
offset_bottom = 12.0
grow_horizontal = 0
theme = ExtResource("7_8t2l7")
bbcode_enabled = true
fit_content = true
autowrap_mode = 0
script = ExtResource("14_e0a18")
instructions_text = "Use %s to move.
Press %s to fire a fireball.
Press %s to change input mappings."
actions = Array[Resource("res://addons/guide/guide_action.gd")]([ExtResource("4_07jn1"), ExtResource("6_esnhm"), ExtResource("3_g1dlj")])
[node name="UI Layer" type="CanvasLayer" parent="."]
[node name="RemappingDialog" parent="UI Layer" instance=ExtResource("7_g0vxv")]
unique_name_in_owner = true
visible = false
[node name="DebugLayer" type="CanvasLayer" parent="."]
[node name="GuideDebugger" parent="DebugLayer" instance=ExtResource("5_kdgir")]
theme = ExtResource("7_8t2l7")

View File

@ -0,0 +1,29 @@
extends HBoxContainer
signal rebind(item:GUIDERemapper.ConfigItem)
@onready var _action_name:Button = %ActionName
@onready var _action_binding:RichTextLabel = %ActionBinding
var _formatter:GUIDEInputFormatter = GUIDEInputFormatter.new(48)
var _item:GUIDERemapper.ConfigItem
func initialize(item:GUIDERemapper.ConfigItem, input:GUIDEInput):
_item = item
_action_name.text = item.display_name
_item.changed.connect(_show_input)
_show_input(input)
func _on_action_name_pressed():
if _item != null:
rebind.emit(_item)
func _show_input(input:GUIDEInput):
if input != null:
var text = await _formatter.input_as_richtext_async(input)
_action_binding.parse_bbcode(text)
else:
_action_binding.parse_bbcode("<not bound>")

View File

@ -0,0 +1 @@
uid://cfukq2iogf0k4

View File

@ -0,0 +1,32 @@
[gd_scene load_steps=2 format=3 uid="uid://bme1y0ikthda7"]
[ext_resource type="Script" path="res://guide_examples/remapping/ui/binding_row.gd" id="1_mc50g"]
[node name="BindingRow" type="HBoxContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 10
script = ExtResource("1_mc50g")
[node name="ActionName" type="Button" parent="."]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 10
text = "Lorem ipsum"
flat = true
[node name="ActionBinding" type="RichTextLabel" parent="."]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 2
size_flags_vertical = 4
bbcode_enabled = true
fit_content = true
scroll_active = false
autowrap_mode = 0
shortcut_keys_enabled = false
[connection signal="pressed" from="ActionName" to="." method="_on_action_name_pressed"]

View File

@ -0,0 +1,18 @@
@tool
extends MarginContainer
@onready var _label:Label = %Label
@export var text:String:
set(value):
text = value
_refresh()
func _ready():
_refresh()
func _refresh():
if _label != null:
_label.text = text

View File

@ -0,0 +1 @@
uid://dt4gdj0rt5mnw

View File

@ -0,0 +1,36 @@
[gd_scene load_steps=3 format=3 uid="uid://cj1h0wxamje4s"]
[ext_resource type="Script" path="res://guide_examples/remapping/ui/binding_section.gd" id="1_hoxsv"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_h8l7u"]
bg_color = Color(0.355314, 0.355314, 0.355313, 1)
corner_radius_top_left = 10
corner_radius_top_right = 10
corner_radius_bottom_right = 10
corner_radius_bottom_left = 10
[node name="MarginContainer" type="MarginContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_top = 10
theme_override_constants/margin_bottom = 10
script = ExtResource("1_hoxsv")
[node name="Panel" type="Panel" parent="."]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_h8l7u")
[node name="BindingSection" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 5
theme_override_constants/margin_top = 5
theme_override_constants/margin_right = 5
theme_override_constants/margin_bottom = 5
[node name="Label" type="Label" parent="BindingSection"]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 22

View File

@ -0,0 +1,198 @@
## The remapping dialog.
extends MarginContainer
signal closed(applied_config:GUIDERemappingConfig)
const Utils = preload("../utils.gd")
# Input
@export var keyboard_context:GUIDEMappingContext
@export var controller_context:GUIDEMappingContext
@export var binding_keyboard_context:GUIDEMappingContext
@export var binding_controller_context:GUIDEMappingContext
@export var close_dialog:GUIDEAction
@export var switch_to_controller:GUIDEAction
@export var switch_to_keyboard:GUIDEAction
@export var previous_tab:GUIDEAction
@export var next_tab:GUIDEAction
# UI
@export var binding_row_scene:PackedScene
@export var binding_section_scene:PackedScene
@onready var _keyboard_bindings:Container = %KeyboardBindings
@onready var _controller_bindings:Container = %ControllerBindings
@onready var _press_prompt:Control = %PressPrompt
@onready var _controller_invert_horizontal:CheckBox = %ControllerInvertHorizontal
@onready var _controller_invert_vertical:CheckBox = %ControllerInvertVertical
@onready var _tab_container:TabContainer = %TabContainer
## The input detector for detecting new input
@onready var _input_detector:GUIDEInputDetector = %GUIDEInputDetector
## The remapper, helps us quickly remap inputs.
var _remapper:GUIDERemapper = GUIDERemapper.new()
## The config we're currently working on
var _remapping_config:GUIDERemappingConfig
## The last control that was focused when we started input detection.
## Used to restore focus afterwards.
var _focused_control:Control = null
func _ready():
# connect the actions that the remapping dialog uses
close_dialog.triggered.connect(_on_close_dialog)
switch_to_controller.triggered.connect(_switch.bind(binding_controller_context))
switch_to_keyboard.triggered.connect(_switch.bind(binding_keyboard_context))
previous_tab.triggered.connect(_switch_tab.bind(-1))
next_tab.triggered.connect(_switch_tab.bind(1))
func open():
# switch the tab to the scheme that is currently enabled
# to make life a bit easier for the player, and also
# enable the correct mapping context for the binding dialog
if GUIDE.is_mapping_context_enabled(controller_context):
_tab_container.current_tab = 1
GUIDE.enable_mapping_context(binding_controller_context, true)
else:
_tab_container.current_tab = 0
GUIDE.enable_mapping_context(binding_keyboard_context, true)
# todo provide specific actions for the tab bar controller
_tab_container.get_tab_bar().grab_focus()
# Open the user's last edited remapping config, if it exists
_remapping_config = Utils.load_remapping_config()
# And initialize the remapper
_remapper.initialize([keyboard_context, controller_context], _remapping_config)
_clear(_keyboard_bindings)
_clear(_controller_bindings)
# fill the keyboard section
_fill_remappable_items(keyboard_context, _keyboard_bindings)
# fill the controller section
_fill_remappable_items(controller_context, _controller_bindings)
_controller_invert_horizontal.button_pressed = _remapper.get_custom_data("invert_horizontal", false)
_controller_invert_vertical.button_pressed = _remapper.get_custom_data("invert_vertical", false)
visible = true
## Fills remappable items and sub-sections into the given container
func _fill_remappable_items(context:GUIDEMappingContext, root:Container):
var items := _remapper.get_remappable_items(context)
var section_name = ""
for item in items:
if item.display_category != section_name:
section_name = item.display_category
var section = binding_section_scene.instantiate()
root.add_child(section)
section.text = section_name
var instance = binding_row_scene.instantiate()
root.add_child(instance)
# Show the current binding.
instance.initialize(item, _remapper.get_bound_input_or_null(item))
instance.rebind.connect(_rebind_item)
func _rebind_item(item:GUIDERemapper.ConfigItem):
_focused_control = get_viewport().gui_get_focus_owner()
_focused_control.release_focus()
_press_prompt.visible = true
# Limit the devices that we can detect based on which
# mapping context we're currently working on. So
# for keyboard only keys can be bound and for controller
# only controller buttons can be bound.
var device := GUIDEInputDetector.DeviceType.KEYBOARD
if item.context == controller_context:
device = GUIDEInputDetector.DeviceType.JOY
# detect a new input
_input_detector.detect(item.value_type, [device])
var input = await _input_detector.input_detected
_press_prompt.visible = false
_focused_control.grab_focus()
# check if the detection was aborted.
if input == null:
return
# check for collisions
var collisions := _remapper.get_input_collisions(item, input)
# if any collision is from a non-bindable mapping, we cannot use this input
if collisions.any(func(it:GUIDERemapper.ConfigItem): return not it.is_remappable):
return
# unbind the colliding entries.
for collision in collisions:
_remapper.set_bound_input(collision, null)
# now bind the new input
_remapper.set_bound_input(item, input)
func _clear(root:Container):
for child in root.get_children():
root.remove_child(child)
child.queue_free()
func _on_abort_detection():
_input_detector.abort_detection()
func _on_close_dialog():
if _input_detector.is_detecting:
return
# same as pressing return to game
_on_return_to_game_pressed()
func _on_controller_invert_horizontal_toggled(toggled_on:bool):
_remapper.set_custom_data(Utils.CUSTOM_DATA_INVERT_HORIZONTAL, toggled_on)
func _on_controller_invert_vertical_toggled(toggled_on:bool):
_remapper.set_custom_data(Utils.CUSTOM_DATA_INVERT_VERTICAL, toggled_on)
func _on_return_to_game_pressed():
# get the modified config
var final_config := _remapper.get_mapping_config()
# store it
Utils.save_remapping_config(final_config)
# restore main mapping context based on what is currently active
if GUIDE.is_mapping_context_enabled(binding_keyboard_context):
GUIDE.enable_mapping_context(keyboard_context, true)
else:
GUIDE.enable_mapping_context(controller_context, true)
# and close the dialog
visible = false
closed.emit(final_config)
func _switch_tab(index:int):
_tab_container.current_tab = posmod(_tab_container.current_tab + index, 2)
func _switch(context:GUIDEMappingContext):
# only do this when the dialog is visible
if not visible:
return
GUIDE.enable_mapping_context(context, true)

View File

@ -0,0 +1 @@
uid://5crxnd8ysf6

View File

@ -0,0 +1,224 @@
[gd_scene load_steps=21 format=3 uid="uid://bq0w7uaotgfct"]
[ext_resource type="Script" path="res://guide_examples/remapping/ui/remapping_dialog.gd" id="1_6hgqj"]
[ext_resource type="Theme" uid="uid://dot0gi1yoqmrl" path="res://guide_examples/shared/ui_theme.tres" id="1_uhsj0"]
[ext_resource type="Resource" uid="uid://cu0dhstc00cj5" path="res://guide_examples/remapping/mapping_contexts/keyboard.tres" id="2_cgour"]
[ext_resource type="Script" path="res://addons/guide/remapping/guide_input_detector.gd" id="3_o0nvn"]
[ext_resource type="Resource" uid="uid://bexjevffjsh3i" path="res://guide_examples/remapping/mapping_contexts/controller.tres" id="3_tgkdx"]
[ext_resource type="PackedScene" uid="uid://bme1y0ikthda7" path="res://guide_examples/remapping/ui/binding_row.tscn" id="4_iojgu"]
[ext_resource type="PackedScene" uid="uid://cj1h0wxamje4s" path="res://guide_examples/remapping/ui/binding_section.tscn" id="5_8v80s"]
[ext_resource type="Resource" uid="uid://bqd45wwsetlyg" path="res://guide_examples/remapping/mapping_contexts/binding_keyboard.tres" id="5_tw3jw"]
[ext_resource type="Resource" uid="uid://dubuepcs1w17f" path="res://guide_examples/remapping/mapping_contexts/binding_controller.tres" id="6_gdrkn"]
[ext_resource type="Resource" uid="uid://bcum2m26we6ct" path="res://guide_examples/remapping/mapping_contexts/shared_actions/close_menu.tres" id="7_djty7"]
[ext_resource type="Resource" uid="uid://3vqfs786vcsa" path="res://guide_examples/remapping/mapping_contexts/keyboard_actions/switch_to_controller.tres" id="8_lj8gw"]
[ext_resource type="Resource" uid="uid://ce3ytxn2tcxxe" path="res://guide_examples/remapping/mapping_contexts/controller_actions/switch_to_keyboard.tres" id="9_brmt1"]
[ext_resource type="Script" path="res://guide_examples/shared/instructions_label.gd" id="10_xsw70"]
[ext_resource type="Script" path="res://addons/guide/inputs/guide_input_key.gd" id="11_e078a"]
[ext_resource type="Resource" uid="uid://cfrx54l1vmjey" path="res://guide_examples/remapping/mapping_contexts/controller_actions/previous_tab.tres" id="11_uxwof"]
[ext_resource type="Resource" uid="uid://dg1or0do0s1ad" path="res://guide_examples/remapping/mapping_contexts/controller_actions/next_tab.tres" id="12_byojv"]
[ext_resource type="Script" path="res://addons/guide/inputs/guide_input_joy_button.gd" id="12_hftpv"]
[sub_resource type="Resource" id="Resource_f3bao"]
script = ExtResource("11_e078a")
key = 4194305
shift = false
control = false
alt = false
meta = false
allow_additional_modifiers = false
[sub_resource type="Resource" id="Resource_twrga"]
script = ExtResource("12_hftpv")
button = 4
joy_index = -1
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bagfg"]
bg_color = Color(0.266575, 0.266575, 0.266575, 1)
[node name="RemappingDialog" type="MarginContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_uhsj0")
script = ExtResource("1_6hgqj")
keyboard_context = ExtResource("2_cgour")
controller_context = ExtResource("3_tgkdx")
binding_keyboard_context = ExtResource("5_tw3jw")
binding_controller_context = ExtResource("6_gdrkn")
close_dialog = ExtResource("7_djty7")
switch_to_controller = ExtResource("8_lj8gw")
switch_to_keyboard = ExtResource("9_brmt1")
previous_tab = ExtResource("11_uxwof")
next_tab = ExtResource("12_byojv")
binding_row_scene = ExtResource("4_iojgu")
binding_section_scene = ExtResource("5_8v80s")
[node name="Blocker" type="ColorRect" parent="."]
layout_mode = 2
color = Color(8.66354e-07, 0.331199, 0.634906, 0.352941)
[node name="CenterContainer" type="CenterContainer" parent="."]
layout_mode = 2
[node name="PanelContainer" type="PanelContainer" parent="CenterContainer"]
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer"]
custom_minimum_size = Vector2(800, 600)
layout_mode = 2
theme_override_constants/separation = 20
[node name="Label" type="Label" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_type_variation = &"HeaderLarge"
text = "Input Rebinding"
horizontal_alignment = 1
[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="TabContainer" type="TabContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
tab_alignment = 1
current_tab = 1
clip_tabs = false
[node name="Keyboard" type="PanelContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/TabContainer"]
visible = false
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/TabContainer/Keyboard"]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="ScrollContainer" type="ScrollContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/TabContainer/Keyboard/MarginContainer"]
layout_mode = 2
[node name="KeyboardBindings" type="VBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/TabContainer/Keyboard/MarginContainer/ScrollContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
[node name="Controller" type="PanelContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/TabContainer"]
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/TabContainer/Controller"]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="ScrollContainer" type="ScrollContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/TabContainer/Controller/MarginContainer"]
layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/TabContainer/Controller/MarginContainer/ScrollContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="ControllerBindings" type="VBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/TabContainer/Controller/MarginContainer/ScrollContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
[node name="Section" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/TabContainer/Controller/MarginContainer/ScrollContainer/VBoxContainer" instance=ExtResource("5_8v80s")]
layout_mode = 2
text = "Miscellaneous"
[node name="ControllerInvertHorizontal" type="CheckBox" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/TabContainer/Controller/MarginContainer/ScrollContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Invert horizontal movement"
[node name="ControllerInvertVertical" type="CheckBox" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/TabContainer/Controller/MarginContainer/ScrollContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Invert vertical movement"
[node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer"]
layout_mode = 2
mouse_filter = 2
[node name="RichTextLabel" type="RichTextLabel" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer"]
layout_mode = 2
mouse_filter = 2
fit_content = true
scroll_active = false
autowrap_mode = 0
script = ExtResource("10_xsw70")
instructions_text = "%s"
actions = Array[Resource("res://addons/guide/guide_action.gd")]([ExtResource("11_uxwof")])
[node name="Control" type="Control" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
mouse_filter = 2
[node name="RichTextLabel2" type="RichTextLabel" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer"]
layout_mode = 2
mouse_filter = 2
fit_content = true
scroll_active = false
autowrap_mode = 0
script = ExtResource("10_xsw70")
instructions_text = "%s"
actions = Array[Resource("res://addons/guide/guide_action.gd")]([ExtResource("12_byojv")])
[node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
alignment = 1
[node name="ReturnToGame" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Return to game"
[node name="GUIDEInputDetector" type="Node" parent="."]
unique_name_in_owner = true
editor_description = "This node has two inputs specified which count as abort for detection (Escape and Controller back button)."
script = ExtResource("3_o0nvn")
detection_countdown_seconds = 0.1
abort_detection_on = Array[Resource("res://addons/guide/inputs/guide_input.gd")]([SubResource("Resource_f3bao"), SubResource("Resource_twrga")])
[node name="PressPrompt" type="MarginContainer" parent="."]
unique_name_in_owner = true
visible = false
layout_mode = 2
mouse_filter = 0
[node name="CenterContainer" type="CenterContainer" parent="PressPrompt"]
layout_mode = 2
[node name="Panel" type="PanelContainer" parent="PressPrompt/CenterContainer"]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_bagfg")
[node name="MarginContainer" type="MarginContainer" parent="PressPrompt/CenterContainer/Panel"]
layout_mode = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="Label" type="Label" parent="PressPrompt/CenterContainer/Panel/MarginContainer"]
layout_mode = 2
text = "Press new input..."
[connection signal="toggled" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/TabContainer/Controller/MarginContainer/ScrollContainer/VBoxContainer/ControllerInvertHorizontal" to="." method="_on_controller_invert_horizontal_toggled"]
[connection signal="toggled" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/TabContainer/Controller/MarginContainer/ScrollContainer/VBoxContainer/ControllerInvertVertical" to="." method="_on_controller_invert_vertical_toggled"]
[connection signal="pressed" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer/ReturnToGame" to="." method="_on_return_to_game_pressed"]

View File

@ -0,0 +1,18 @@
const REMAPPING_CONFIG_PATH = "user://remapping_config.tres"
# Constants for custom data that we store in the remapping config.
const CUSTOM_DATA_INVERT_HORIZONTAL = "invert_horizontal"
const CUSTOM_DATA_INVERT_VERTICAL = "invert_vertical"
## Loads the saved remapping config if it exists, or an empty remapping
## config if none exists.
static func load_remapping_config() -> GUIDERemappingConfig:
if ResourceLoader.exists(REMAPPING_CONFIG_PATH):
return ResourceLoader.load(REMAPPING_CONFIG_PATH)
else:
return GUIDERemappingConfig.new()
## Saves the given remapping config to the user folder
static func save_remapping_config(config:GUIDERemappingConfig) -> void:
ResourceSaver.save(config, REMAPPING_CONFIG_PATH)
config.take_over_path(REMAPPING_CONFIG_PATH)

View File

@ -0,0 +1 @@
uid://chnxcg46gaypy