Ui Rebuild and Full Controller Support #59
1 changed files with 5 additions and 5 deletions
|
@ -50,20 +50,20 @@ func start_remap(button : Button, action : String):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func remap_key(event):
|
func remap_key(event):
|
||||||
set_process_unhandled_key_input(false)
|
|
||||||
for key in InputMap.action_get_events(remap_action):
|
|
||||||
InputMap.action_erase_event(remap_action, key)
|
|
||||||
InputMap.action_add_event(remap_action, event)
|
|
||||||
|
|
||||||
match str(event.get_class()):
|
match str(event.get_class()):
|
||||||
"InputEventJoypadButton":
|
"InputEventJoypadButton":
|
||||||
Save.game_data["%s" % [remap_action]] = "b" + str(event.button_index)
|
Save.game_data["%s" % [remap_action]] = "b" + str(event.button_index)
|
||||||
"InputEventJoypadMotion":
|
"InputEventJoypadMotion":
|
||||||
|
if abs(event.axis_value) < 0.5: return
|
||||||
Save.game_data["%s" % [remap_action]] = "j" + str(event.axis) + str("/1.00" if event.axis_value > 0 else "/-1.00")
|
Save.game_data["%s" % [remap_action]] = "j" + str(event.axis) + str("/1.00" if event.axis_value > 0 else "/-1.00")
|
||||||
"InputEventMouseButton":
|
"InputEventMouseButton":
|
||||||
Save.game_data["%s" % [remap_action]] = "m" + str(event.button_index)
|
Save.game_data["%s" % [remap_action]] = "m" + str(event.button_index)
|
||||||
"InputEventKey":
|
"InputEventKey":
|
||||||
Save.game_data["%s" % [remap_action]] = event.keycode
|
Save.game_data["%s" % [remap_action]] = event.keycode
|
||||||
|
set_process_unhandled_key_input(false)
|
||||||
|
for key in InputMap.action_get_events(remap_action):
|
||||||
|
InputMap.action_erase_event(remap_action, key)
|
||||||
|
InputMap.action_add_event(remap_action, event)
|
||||||
remap_button.display_key()
|
remap_button.display_key()
|
||||||
remap_button.grab_focus()
|
remap_button.grab_focus()
|
||||||
remap_button.disabled = false
|
remap_button.disabled = false
|
||||||
|
|
Reference in a new issue