caneen/node_2d.gd

33 lines
935 B
GDScript3
Raw Normal View History

2024-01-12 04:07:11 +01:00
extends Node2D
# https://docs.godotengine.org/en/stable/classes/class_inputeventmidi.html
# https://docs.godotengine.org/en/stable/classes/class_%40globalscope.html#enum-globalscope-midimessage
# Called when the node enters the scene tree for the first time.
func _ready():
OS.open_midi_inputs()
print(OS.get_connected_midi_inputs())
func _unhandled_input(event):
if event is InputEventKey:
if event.keycode == KEY_ESCAPE:
get_tree().quit()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
# process inputs
if Input.is_action_pressed("quit"):
# exit the software
get_tree().quit()
if Input.is_action_pressed("left") or MIDIMessage.MIDI_MESSAGE_CONTROL_CHANGE == 1:
# trigger the left controller
print("left")
if Input.is_action_pressed("right") or MIDIMessage.MIDI_MESSAGE_CONTROL_CHANGE == 1:
# trigger the right controller
print("right")
right_turn