21 lines
617 B
GDScript
21 lines
617 B
GDScript
extends Button
|
|
|
|
@export var input_action_name : String
|
|
@export var remap_controller : Node
|
|
|
|
func _ready():
|
|
display_key()
|
|
|
|
func display_key ():
|
|
self.text = "%s" % InputMap.action_get_events(input_action_name)[0].as_text()
|
|
if self.text.begins_with("Joypad Motion on Axis"):
|
|
var split_text = self.text.split(" ")
|
|
self.text = split_text[3] + " " + split_text[4]
|
|
if self.text.begins_with("Joypad Button"):
|
|
var split_text = self.text.split(" ")
|
|
self.text = split_text[1] + " " + split_text[2]
|
|
pass
|
|
|
|
func _on_pressed():
|
|
remap_controller.start_remap(self, input_action_name)
|
|
pass # Replace with function body.
|