diff --git a/scripts/StepMenu.gd b/scripts/StepMenu.gd index a3f41ea..daaa951 100644 --- a/scripts/StepMenu.gd +++ b/scripts/StepMenu.gd @@ -84,6 +84,13 @@ class lerp_array extends Resource: return len(array) +var joypad_labels = [] +func update_joypad_labels(): + var num_joypads = Input.get_connected_joypads() + joypad_labels = [] + for i in num_joypads: + joypad_labels.append(Input.get_joy_name(i)) + func get_rect_center(rect: Rect2) -> Vector2: return rect.position + rect.size*0.5 @@ -481,6 +488,11 @@ func _draw(): touch_rects[menu_mode] = _draw_score_screen(center) ScoreText.show() + var joypad_labels_pos = Vector2(32, 32) + for i in len(joypad_labels): + draw_string(TitleFont, joypad_labels_pos, "Joypad #%02d: %s"%[i, joypad_labels[i]]) + joypad_labels_pos.y += 32 + func set_menu_mode(mode): Receptors.fade(mode == MenuMode.GAMEPLAY) if mode == MenuMode.GAMEPLAY: @@ -544,11 +556,33 @@ func finished_song(song_key, score_data): scorescreen_saved = false set_menu_mode(MenuMode.SCORE_SCREEN) +func is_6button(device: int) -> bool: + match Input.get_joy_name(device): + "LHW FatMatV3": + return true + "LHW FatMat2": + return true + _: # For now, 12 button + return false func _input(event): if !visible: return - if (event is InputEventMouseButton): # Add this if we ever manage to be rid of the curse of Touch->Mouse emulation: (event is InputEventScreenTouch) + + if event is InputEventJoypadButton: + update_joypad_labels() + print_debug("Joypad #%02d is a '%s'" % [event.device, Input.get_joy_name(event.device)]) + # event.device + # event.button_index + # event.pressed + elif event is InputEventJoypadMotion: + update_joypad_labels() + print_debug("Joypad #%02d is a '%s'" % [event.device, Input.get_joy_name(event.device)]) + # event.device + # event.axis + # event.axis_value + + elif event is InputEventMouseButton: # Add this if we ever manage to be rid of the curse of Touch->Mouse emulation: (event is InputEventScreenTouch) # print(event) if event.pressed: var pos = event.position - get_global_transform_with_canvas().get_origin()