extends MarginContainer # class member variables go here, for example: # var a = 2 # var b = "textvar" const ACTION_LIST = [ "ui_debug_window", "ui_music_controls", "move_up", "move_down", "move_left", "move_right", "game_flashlight", "ui_pause", "ui_reload", "ui_free_cursor", "ui_quit" ] const ACTION_TEXT = [ "show/hide debug", "show/hide music", "move up", "move down", "move left", "move right", "on/off flashlight", "pause/play", "reload the scene", "free/capture mouse cursor", "quit" ] func _ready(): # Called every time the node is added to the scene. # Initialization here var index = 0 for action_name in ACTION_LIST: for event in InputMap.get_action_list( action_name ): if event is InputEventKey: var label = Label.new() label.name = action_name label.text = ACTION_TEXT[ index ] + ": " + OS.get_scancode_string( event.get_scancode_with_modifiers() ) $MarginContainer/VBoxContainer.add_child( label ) label.set_owner( $MarginContainer/VBoxContainer ) index += 1 func _on_Refresh_pressed(): for action_name in ACTION_LIST: for event in InputMap.get_action_list( action_name ): if event is InputEventKey: get_node( "MarginContainer/VBoxContainer" ).get_node( action_name ).text = action_name + ": " + OS.get_scancode_string( event.get_scancode_with_modifiers() ) func _input( event ): if event.is_action_pressed( "ui_debug_window" ): self.visible = not self.visible