2018-07-25 07:36:19 +00:00
|
|
|
extends MarginContainer
|
|
|
|
|
|
|
|
# class member variables go here, for example:
|
|
|
|
# var a = 2
|
|
|
|
# var b = "textvar"
|
|
|
|
|
2018-07-31 08:26:45 +00:00
|
|
|
const ACTION_LIST = [ "ui_debug_window", "ui_music_controls", "hide_char", "ui_hide_all", "move_up", "move_down", "move_left", "move_right", "fly_up", "fly_down","game_flashlight", "ui_pause", "ui_reload", "ui_free_cursor", "ui_quit" ]
|
|
|
|
const ACTION_TEXT = [ "show/hide debug", "show/hide music", "Hide/show character", "hide/show UI", "move up", "move down", "move left", "move right", "fly up", "fly down", "on/off flashlight", "pause/play", "reload the scene", "free/capture mouse cursor", "quit" ]
|
2018-07-25 07:36:19 +00:00
|
|
|
|
|
|
|
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
|