extends Control
var joypads : Array
var joypad_info : Dictionary
@onready var set_button = $SetButton
func _ready():
pass # Replace with function body.
func _process(_delta):
joypads = Input.get_connected_joypads()
func _input(_event : InputEvent):
if joypads.size() < 1: return
if set_button.button_pressed:
# 何かのボタンが押されたか?
if Input.is_anything_pressed():
InputMap.action_add_event("Jump", _event)
var button_index = InputMap.action_get_events("Jump")
if button_index.size() > 0:
print("Setted button from Jump = %d" %button_index[0].button_index)
else:
if Input.is_action_just_pressed("Jump"):
var button_index = InputMap.action_get_events("Jump")
if button_index.size() > 0:
print("Pressed button from Jump = %d" %button_index[0].button_index)