ajout de panneaux de contrôles, de paramètres et refactorisation de la gestion de l'audio
This commit is contained in:
33
gui/menu/controls/scripts/controls.gd
Normal file
33
gui/menu/controls/scripts/controls.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
@tool
|
||||
extends Control
|
||||
|
||||
const INPUT_GROUP_SCENE = preload("res://gui/menu/controls/input_group.tscn")
|
||||
|
||||
@export_tool_button("Update", "Callable") var update_action = create_input_list
|
||||
|
||||
func _ready():
|
||||
create_input_list()
|
||||
if not Engine.is_editor_hint():
|
||||
%ControlsWindow.close_window()
|
||||
show()
|
||||
|
||||
func open_controls():
|
||||
%ControlsWindow.open_window()
|
||||
|
||||
func close_controls():
|
||||
%ControlsWindow.close_window()
|
||||
|
||||
func create_input_list():
|
||||
InputMap.load_from_project_settings()
|
||||
for child in %ControlsContainer.get_children():
|
||||
child.queue_free()
|
||||
|
||||
for action in InputMap.get_actions():
|
||||
if action.substr(0, 3) != "ui_":
|
||||
var input_group = instantiate_input_group()
|
||||
input_group.action_name = action
|
||||
%ControlsContainer.add_child(input_group)
|
||||
|
||||
|
||||
func instantiate_input_group() -> InputGroup:
|
||||
return INPUT_GROUP_SCENE.instantiate() as InputGroup
|
||||
Reference in New Issue
Block a user