23 lines
699 B
GDScript
23 lines
699 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"):
|
|
print(self.text)
|
|
var split_text = self.text.split(" ")
|
|
self.text = "+" if float(split_text[13]) > 0 else "-"
|
|
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.
|