OmnichordGodot/scripts/KeyboardController.gd

87 lines
3.2 KiB
GDScript3
Raw Normal View History

2024-06-27 01:11:23 -03:00
extends Node
func _input(event):
if event is InputEventKey and event.pressed:
# Major (Top Row)
if event.keycode == KEY_Q:
$"Buttons/Chords/eb".button_pressed()
if event.keycode == KEY_W:
$"Buttons/Chords/bb".button_pressed()
if event.keycode == KEY_E:
$"Buttons/Chords/f".button_pressed()
if event.keycode == KEY_R:
$"Buttons/Chords/c".button_pressed()
if event.keycode == KEY_T:
$"Buttons/Chords/g".button_pressed()
if event.keycode == KEY_Y:
$"Buttons/Chords/d".button_pressed()
if event.keycode == KEY_U:
$"Buttons/Chords/a".button_pressed()
if event.keycode == KEY_I:
$"Buttons/Chords/e".button_pressed()
if event.keycode == KEY_O:
$"Buttons/Chords/b".button_pressed()
# Minor (Middle Row)
if event.keycode == KEY_A:
$"Buttons/Chords/ebm".button_pressed()
if event.keycode == KEY_S:
$"Buttons/Chords/bbm".button_pressed()
if event.keycode == KEY_D:
$"Buttons/Chords/fm".button_pressed()
if event.keycode == KEY_F:
$"Buttons/Chords/cm".button_pressed()
if event.keycode == KEY_G:
$"Buttons/Chords/gm".button_pressed()
if event.keycode == KEY_H:
$"Buttons/Chords/dm".button_pressed()
if event.keycode == KEY_J:
$"Buttons/Chords/am".button_pressed()
if event.keycode == KEY_K:
$"Buttons/Chords/em".button_pressed()
if event.keycode == KEY_L:
$"Buttons/Chords/bm".button_pressed()
# 7th (Bottom Row)
if event.keycode == KEY_Z:
$"Buttons/Chords/eb7".button_pressed()
if event.keycode == KEY_X:
$"Buttons/Chords/bb7".button_pressed()
if event.keycode == KEY_C:
$"Buttons/Chords/f7".button_pressed()
if event.keycode == KEY_V:
$"Buttons/Chords/c7".button_pressed()
if event.keycode == KEY_B:
$"Buttons/Chords/g7".button_pressed()
if event.keycode == KEY_N:
$"Buttons/Chords/d7".button_pressed()
if event.keycode == KEY_M:
$"Buttons/Chords/a7".button_pressed()
if event.keycode == KEY_COMMA:
$"Buttons/Chords/e7".button_pressed()
if event.keycode == KEY_PERIOD:
$"Buttons/Chords/b7".button_pressed()
# Notes (Keypad)
if event.keycode == KEY_1 or event.keycode == KEY_KP_1:
$"Buttons/Notes/0".button_pressed()
if event.keycode == KEY_2 or event.keycode == KEY_KP_2:
$"Buttons/Notes/1".button_pressed()
if event.keycode == KEY_3 or event.keycode == KEY_KP_3:
$"Buttons/Notes/2".button_pressed()
if event.keycode == KEY_4 or event.keycode == KEY_KP_4:
$"Buttons/Notes/3".button_pressed()
if event.keycode == KEY_5 or event.keycode == KEY_KP_5:
$"Buttons/Notes/4".button_pressed()
if event.keycode == KEY_6 or event.keycode == KEY_KP_6:
$"Buttons/Notes/5".button_pressed()
if event.keycode == KEY_7 or event.keycode == KEY_KP_7:
$"Buttons/Notes/6".button_pressed()
if event.keycode == KEY_8 or event.keycode == KEY_KP_8:
$"Buttons/Notes/7".button_pressed()
if event.keycode == KEY_9 or event.keycode == KEY_KP_9:
$"Buttons/Notes/8".button_pressed()
if event.keycode == KEY_0 or event.keycode == KEY_KP_DIVIDE:
$"Buttons/Notes/9".button_pressed()
if event.keycode == KEY_MINUS or event.keycode == KEY_KP_MULTIPLY:
$"Buttons/Notes/10".button_pressed()
if event.keycode == KEY_EQUAL or event.keycode == KEY_KP_SUBTRACT:
$"Buttons/Notes/11".button_pressed()