Added reset keybinds to default button
This commit is contained in:
parent
1f24357f1f
commit
0905212626
7 changed files with 99 additions and 35 deletions
|
@ -41,7 +41,7 @@
|
||||||
[ext_resource type="StyleBox" uid="uid://0jfr1uwuog0s" path="res://Assets/UI/Slider/v/background.tres" id="39_dl1e4"]
|
[ext_resource type="StyleBox" uid="uid://0jfr1uwuog0s" path="res://Assets/UI/Slider/v/background.tres" id="39_dl1e4"]
|
||||||
[ext_resource type="FontFile" uid="uid://dqdeftjkwxe64" path="res://Assets/Fonts/Dogica/dogicapixel.ttf" id="40_bmcvq"]
|
[ext_resource type="FontFile" uid="uid://dqdeftjkwxe64" path="res://Assets/Fonts/Dogica/dogicapixel.ttf" id="40_bmcvq"]
|
||||||
|
|
||||||
[sub_resource type="Image" id="Image_fjlcl"]
|
[sub_resource type="Image" id="Image_1bdw3"]
|
||||||
data = {
|
data = {
|
||||||
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0),
|
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0),
|
||||||
"format": "RGBA8",
|
"format": "RGBA8",
|
||||||
|
@ -51,7 +51,7 @@ data = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="ImageTexture" id="ImageTexture_g5bup"]
|
[sub_resource type="ImageTexture" id="ImageTexture_g5bup"]
|
||||||
image = SubResource("Image_fjlcl")
|
image = SubResource("Image_1bdw3")
|
||||||
|
|
||||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_sj7h5"]
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_sj7h5"]
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
[gd_scene load_steps=5 format=3 uid="uid://cbfcolm6mjolp"]
|
[gd_scene load_steps=6 format=3 uid="uid://cbfcolm6mjolp"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Scripts/UI/SettingsMenu.gd" id="1_2rgd2"]
|
[ext_resource type="Script" path="res://Scripts/UI/SettingsMenu.gd" id="1_2rgd2"]
|
||||||
[ext_resource type="Script" path="res://Scripts/UI/Remaping/RemapController.gd" id="2_2f8ap"]
|
[ext_resource type="Script" path="res://Scripts/UI/Remaping/RemapController.gd" id="2_2f8ap"]
|
||||||
[ext_resource type="Script" path="res://Scripts/UI/Remaping/RemapButton.gd" id="2_4asaa"]
|
[ext_resource type="Script" path="res://Scripts/UI/Remaping/RemapButton.gd" id="2_4asaa"]
|
||||||
|
[ext_resource type="Theme" uid="uid://babphdknr2kkd" path="res://Assets/UI/Theme.tres" id="3_ajuuh"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_02uod"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_02uod"]
|
||||||
bg_color = Color(0.439216, 0.631373, 0.537255, 1)
|
bg_color = Color(0.439216, 0.631373, 0.537255, 1)
|
||||||
|
@ -22,7 +23,7 @@ master_volume_slider = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTab
|
||||||
music_volume_slider = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Audio/ScrollView/MarginContainer/HBoxContainer/Item/MusicVolSlider")
|
music_volume_slider = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Audio/ScrollView/MarginContainer/HBoxContainer/Item/MusicVolSlider")
|
||||||
sfx_volume_slider = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Audio/ScrollView/MarginContainer/HBoxContainer/Item/SFXVolSlider")
|
sfx_volume_slider = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Audio/ScrollView/MarginContainer/HBoxContainer/Item/SFXVolSlider")
|
||||||
|
|
||||||
[node name="Remap Controller" type="Control" parent="."]
|
[node name="Remap Controller" type="Control" parent="." node_paths=PackedStringArray("remap_buttons_holder")]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
|
@ -31,6 +32,7 @@ offset_top = 12.0
|
||||||
offset_right = 12.0
|
offset_right = 12.0
|
||||||
offset_bottom = 12.0
|
offset_bottom = 12.0
|
||||||
script = ExtResource("2_2f8ap")
|
script = ExtResource("2_2f8ap")
|
||||||
|
remap_buttons_holder = NodePath("../Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item")
|
||||||
|
|
||||||
[node name="Panel" type="Panel" parent="."]
|
[node name="Panel" type="Panel" parent="."]
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
|
@ -38,6 +40,7 @@ anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
theme = ExtResource("3_ajuuh")
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_02uod")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_02uod")
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="Panel"]
|
[node name="MarginContainer" type="MarginContainer" parent="Panel"]
|
||||||
|
@ -341,6 +344,16 @@ layout_mode = 2
|
||||||
text = "Attack Controller
|
text = "Attack Controller
|
||||||
"
|
"
|
||||||
|
|
||||||
|
[node name="Spacer2" type="MarginContainer" parent="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Label"]
|
||||||
|
custom_minimum_size = Vector2(0, 32)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="ResetLabel" type="Label" parent="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Label"]
|
||||||
|
custom_minimum_size = Vector2(0, 48)
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Reset to Defaults"
|
||||||
|
|
||||||
[node name="Spacer" type="MarginContainer" parent="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer"]
|
[node name="Spacer" type="MarginContainer" parent="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
@ -469,6 +482,16 @@ script = ExtResource("2_4asaa")
|
||||||
input_action_name = "attack_controller"
|
input_action_name = "attack_controller"
|
||||||
remap_controller = NodePath("../../../../../../../../../../Remap Controller")
|
remap_controller = NodePath("../../../../../../../../../../Remap Controller")
|
||||||
|
|
||||||
|
[node name="Spacers2" type="MarginContainer" parent="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item"]
|
||||||
|
custom_minimum_size = Vector2(0, 32)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="ResetButton" type="Button" parent="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item"]
|
||||||
|
custom_minimum_size = Vector2(400, 40)
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Reset"
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="Panel/MarginContainer/VBoxContainer"]
|
[node name="MarginContainer" type="MarginContainer" parent="Panel/MarginContainer/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/margin_top = 32
|
theme_override_constants/margin_top = 32
|
||||||
|
@ -501,4 +524,5 @@ text = "Back"
|
||||||
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item/AimLeftControllerRemapButton" to="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item/AimLeftControllerRemapButton" method="_on_pressed"]
|
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item/AimLeftControllerRemapButton" to="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item/AimLeftControllerRemapButton" method="_on_pressed"]
|
||||||
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item/AimRightControllerRemapButton" to="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item/AimRightControllerRemapButton" method="_on_pressed"]
|
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item/AimRightControllerRemapButton" to="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item/AimRightControllerRemapButton" method="_on_pressed"]
|
||||||
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item/AttackControllerRemapButton" to="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item/AttackControllerRemapButton" method="_on_pressed"]
|
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item/AttackControllerRemapButton" to="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item/AttackControllerRemapButton" method="_on_pressed"]
|
||||||
|
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/SettingsTabs/Controls/ScrollView/MarginContainer/HBoxContainer/Item/ResetButton" to="Remap Controller" method="_on_reset_button_pressed"]
|
||||||
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/MarginContainer/Back Button" to="." method="_on_back_pressed"]
|
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/MarginContainer/Back Button" to="." method="_on_back_pressed"]
|
||||||
|
|
|
@ -2,6 +2,30 @@ extends Node
|
||||||
|
|
||||||
const SAVE_FILE : String = "user://SAVEFILE.save"
|
const SAVE_FILE : String = "user://SAVEFILE.save"
|
||||||
var game_data = {}
|
var game_data = {}
|
||||||
|
var default_game_data = {
|
||||||
|
"display_mode": 0,
|
||||||
|
"vsync_on": false,
|
||||||
|
"current_resolution_index": 0,
|
||||||
|
"master_volume": 0,
|
||||||
|
"music_volume": 0,
|
||||||
|
"sfx_volume": 0,
|
||||||
|
"controls": {
|
||||||
|
"move_up": KEY_W,
|
||||||
|
"move_left": KEY_A,
|
||||||
|
"move_down": KEY_S,
|
||||||
|
"move_right": KEY_D,
|
||||||
|
"attack": "m" + str(MOUSE_BUTTON_LEFT),
|
||||||
|
"move_up_controller": "j" + str(JOY_AXIS_LEFT_Y) + "/-1.00",
|
||||||
|
"move_left_controller": "j" + str(JOY_AXIS_LEFT_X) + "/-1.00",
|
||||||
|
"move_down_controller": "j" + str(JOY_AXIS_LEFT_Y) + "/1.00",
|
||||||
|
"move_right_controller": "j" + str(JOY_AXIS_LEFT_X) + "/1.00",
|
||||||
|
"attack_controller": "b" + str(JOY_BUTTON_A),
|
||||||
|
"aim_up_controller": "j" + str(JOY_AXIS_RIGHT_Y) + "/-1.00",
|
||||||
|
"aim_left_controller": "j" + str(JOY_AXIS_RIGHT_X) + "/-1.00",
|
||||||
|
"aim_down_controller": "j" + str(JOY_AXIS_RIGHT_Y) + "/1.00",
|
||||||
|
"aim_right_controller": "j" + str(JOY_AXIS_RIGHT_X) + "/1.00",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
load_data()
|
load_data()
|
||||||
|
@ -9,28 +33,7 @@ func _ready():
|
||||||
func load_data():
|
func load_data():
|
||||||
var file = FileAccess.open(SAVE_FILE, FileAccess.READ)
|
var file = FileAccess.open(SAVE_FILE, FileAccess.READ)
|
||||||
if file == null:
|
if file == null:
|
||||||
game_data = {
|
game_data = default_game_data
|
||||||
"display_mode": 0,
|
|
||||||
"vsync_on": false,
|
|
||||||
"current_resolution_index": 0,
|
|
||||||
"master_volume": 0,
|
|
||||||
"music_volume": 0,
|
|
||||||
"sfx_volume": 0,
|
|
||||||
"move_up": KEY_W,
|
|
||||||
"move_left": KEY_A,
|
|
||||||
"move_down": KEY_S,
|
|
||||||
"move_right": KEY_D,
|
|
||||||
"attack": "m" + str(MOUSE_BUTTON_LEFT),
|
|
||||||
"move_up_controller": "j" + str(JOY_AXIS_LEFT_Y) + "/-1.00",
|
|
||||||
"move_left_controller": "j" + str(JOY_AXIS_LEFT_X) + "/-1.00",
|
|
||||||
"move_down_controller": "j" + str(JOY_AXIS_LEFT_Y) + "/1.00",
|
|
||||||
"move_right_controller": "j" + str(JOY_AXIS_LEFT_X) + "/1.00",
|
|
||||||
"attack_controller": "b" + str(JOY_BUTTON_A),
|
|
||||||
"aim_up_controller": "j" + str(JOY_AXIS_RIGHT_Y) + "/-1.00",
|
|
||||||
"aim_left_controller": "j" + str(JOY_AXIS_RIGHT_X) + "/-1.00",
|
|
||||||
"aim_down_controller": "j" + str(JOY_AXIS_RIGHT_Y) + "/1.00",
|
|
||||||
"aim_right_controller": "j" + str(JOY_AXIS_RIGHT_X) + "/1.00",
|
|
||||||
}
|
|
||||||
save_data()
|
save_data()
|
||||||
else:
|
else:
|
||||||
game_data = file.get_var()
|
game_data = file.get_var()
|
||||||
|
|
|
@ -81,10 +81,38 @@ func update_sfx_volume(vol : int) -> void:
|
||||||
# Controls
|
# Controls
|
||||||
func set_controls_from_save_file() -> void:
|
func set_controls_from_save_file() -> void:
|
||||||
for remappable_input_action in remappable_input_actions:
|
for remappable_input_action in remappable_input_actions:
|
||||||
var action = Save.game_data.keys().find(remappable_input_action)
|
var action = Save.game_data.controls.keys().find(remappable_input_action)
|
||||||
for key in InputMap.action_get_events(remappable_input_action):
|
for key in InputMap.action_get_events(remappable_input_action):
|
||||||
InputMap.action_erase_event(remappable_input_action, key)
|
InputMap.action_erase_event(remappable_input_action, key)
|
||||||
var binding = Save.game_data.values()[action]
|
var binding = Save.game_data.controls.values()[action]
|
||||||
|
var control_event
|
||||||
|
match str(binding)[0]:
|
||||||
|
"m":
|
||||||
|
binding = int(binding.right(binding.length()-1))
|
||||||
|
control_event = InputEventMouseButton.new()
|
||||||
|
control_event.button_index = binding
|
||||||
|
"b":
|
||||||
|
binding = int(binding.right(binding.length()-1))
|
||||||
|
control_event = InputEventJoypadButton.new()
|
||||||
|
control_event.button_index = binding
|
||||||
|
"j":
|
||||||
|
binding = binding.right(binding.length()-1)
|
||||||
|
binding = binding.split("/")
|
||||||
|
control_event = InputEventJoypadMotion.new()
|
||||||
|
control_event.axis = int(binding[0])
|
||||||
|
control_event.axis_value = float(binding[1])
|
||||||
|
_:
|
||||||
|
control_event = InputEventKey.new()
|
||||||
|
control_event.set_keycode(binding)
|
||||||
|
InputMap.action_add_event(remappable_input_action, control_event)
|
||||||
|
pass
|
||||||
|
|
||||||
|
func reset_controls_to_save_file() -> void:
|
||||||
|
for remappable_input_action in remappable_input_actions:
|
||||||
|
var action = Save.default_game_data.controls.keys().find(remappable_input_action)
|
||||||
|
for key in InputMap.action_get_events(remappable_input_action):
|
||||||
|
InputMap.action_erase_event(remappable_input_action, key)
|
||||||
|
var binding = Save.default_game_data.controls.values()[action]
|
||||||
var control_event
|
var control_event
|
||||||
match str(binding)[0]:
|
match str(binding)[0]:
|
||||||
"m":
|
"m":
|
||||||
|
|
|
@ -4,7 +4,8 @@ extends Button
|
||||||
@export var remap_controller : Node
|
@export var remap_controller : Node
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
display_key()
|
self.add_to_group("RemappableButton")
|
||||||
|
self.display_key()
|
||||||
|
|
||||||
func display_key ():
|
func display_key ():
|
||||||
self.text = "%s" % InputMap.action_get_events(input_action_name)[0].as_text()
|
self.text = "%s" % InputMap.action_get_events(input_action_name)[0].as_text()
|
||||||
|
|
|
@ -2,6 +2,7 @@ extends Control
|
||||||
class_name RemapController
|
class_name RemapController
|
||||||
|
|
||||||
@export var min_time_between_remaps := 0.4
|
@export var min_time_between_remaps := 0.4
|
||||||
|
@export var remap_buttons_holder : VBoxContainer
|
||||||
|
|
||||||
var remap_button : Button
|
var remap_button : Button
|
||||||
var remap_action : String
|
var remap_action : String
|
||||||
|
@ -52,14 +53,14 @@ func start_remap(button : Button, action : String):
|
||||||
func remap_key(event):
|
func remap_key(event):
|
||||||
match str(event.get_class()):
|
match str(event.get_class()):
|
||||||
"InputEventJoypadButton":
|
"InputEventJoypadButton":
|
||||||
Save.game_data["%s" % [remap_action]] = "b" + str(event.button_index)
|
Save.game_data.controls["%s" % [remap_action]] = "b" + str(event.button_index)
|
||||||
"InputEventJoypadMotion":
|
"InputEventJoypadMotion":
|
||||||
if abs(event.axis_value) < 0.5: return
|
if abs(event.axis_value) < 0.5: return
|
||||||
Save.game_data["%s" % [remap_action]] = "j" + str(event.axis) + str("/1.00" if event.axis_value > 0 else "/-1.00")
|
Save.game_data.controls["%s" % [remap_action]] = "j" + str(event.axis) + str("/1.00" if event.axis_value > 0 else "/-1.00")
|
||||||
"InputEventMouseButton":
|
"InputEventMouseButton":
|
||||||
Save.game_data["%s" % [remap_action]] = "m" + str(event.button_index)
|
Save.game_data.controls["%s" % [remap_action]] = "m" + str(event.button_index)
|
||||||
"InputEventKey":
|
"InputEventKey":
|
||||||
Save.game_data["%s" % [remap_action]] = event.keycode
|
Save.game_data.controls["%s" % [remap_action]] = event.keycode
|
||||||
set_process_unhandled_key_input(false)
|
set_process_unhandled_key_input(false)
|
||||||
for key in InputMap.action_get_events(remap_action):
|
for key in InputMap.action_get_events(remap_action):
|
||||||
InputMap.action_erase_event(remap_action, key)
|
InputMap.action_erase_event(remap_action, key)
|
||||||
|
@ -70,3 +71,10 @@ func remap_key(event):
|
||||||
time_since_remap = 0
|
time_since_remap = 0
|
||||||
remap_button = null
|
remap_button = null
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
func _on_reset_button_pressed():
|
||||||
|
GlobalSettings.reset_controls_to_save_file()
|
||||||
|
for child in remap_buttons_holder.get_children():
|
||||||
|
if child is Button and child.is_in_group("RemappableButton"):
|
||||||
|
child.display_key()
|
||||||
|
pass
|
||||||
|
|
|
@ -26,8 +26,8 @@ Save="*res://Scripts/SaveSystem/GameDataSaver.gd"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/viewport_width=640
|
window/size/viewport_width=1280
|
||||||
window/size/viewport_height=1000
|
window/size/viewport_height=800
|
||||||
window/stretch/mode="canvas_items"
|
window/stretch/mode="canvas_items"
|
||||||
window/stretch/aspect="expand"
|
window/stretch/aspect="expand"
|
||||||
|
|
||||||
|
|
Reference in a new issue