This repository has been archived on 2024-07-02. You can view files and clone it, but cannot push or open issues or pull requests.
HoppyEaster/Scripts/UI/Remaping/RemapButton.gd

24 lines
699 B
GDScript3
Raw Permalink Normal View History

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.