Better piano keybinds
This commit is contained in:
parent
5446ffe40b
commit
e3aea7fc9e
@ -127,24 +127,50 @@ func (element *Piano) pressUnderMouseCursor (point image.Point) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var noteForKey = map[input.Key] music.Note {
|
var noteForKey = map[input.Key] music.Note {
|
||||||
'a': 60,
|
'a': 46,
|
||||||
'w': 61,
|
'z': 47,
|
||||||
's': 62,
|
|
||||||
'e': 63,
|
'x': 48,
|
||||||
'd': 64,
|
'd': 49,
|
||||||
'f': 65,
|
'c': 50,
|
||||||
't': 66,
|
'f': 51,
|
||||||
'g': 67,
|
'v': 52,
|
||||||
'y': 68,
|
'b': 53,
|
||||||
'h': 69,
|
'h': 54,
|
||||||
'u': 70,
|
'n': 55,
|
||||||
'j': 71,
|
'j': 56,
|
||||||
'k': 72,
|
'm': 57,
|
||||||
'o': 73,
|
'k': 58,
|
||||||
'l': 74,
|
',': 59,
|
||||||
'p': 75,
|
'.': 60,
|
||||||
';': 76,
|
';': 61,
|
||||||
'\'': 77,
|
'/': 62,
|
||||||
|
'\'': 63,
|
||||||
|
|
||||||
|
'1': 56,
|
||||||
|
'q': 57,
|
||||||
|
'2': 58,
|
||||||
|
'w': 59,
|
||||||
|
|
||||||
|
'e': 60,
|
||||||
|
'4': 61,
|
||||||
|
'r': 62,
|
||||||
|
'5': 63,
|
||||||
|
't': 64,
|
||||||
|
'y': 65,
|
||||||
|
'7': 66,
|
||||||
|
'u': 67,
|
||||||
|
'8': 68,
|
||||||
|
'i': 69,
|
||||||
|
'9': 70,
|
||||||
|
'o': 71,
|
||||||
|
|
||||||
|
'p': 72,
|
||||||
|
'-': 73,
|
||||||
|
'[': 74,
|
||||||
|
'=': 75,
|
||||||
|
']': 76,
|
||||||
|
'\\': 77,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (element *Piano) HandleKeyDown (key input.Key, modifiers input.Modifiers) {
|
func (element *Piano) HandleKeyDown (key input.Key, modifiers input.Modifiers) {
|
||||||
|
@ -49,6 +49,7 @@ func run () {
|
|||||||
container.Adopt(piano, true)
|
container.Adopt(piano, true)
|
||||||
piano.OnPress(playNote)
|
piano.OnPress(playNote)
|
||||||
piano.OnRelease(stopNote)
|
piano.OnRelease(stopNote)
|
||||||
|
piano.Focus()
|
||||||
|
|
||||||
window.OnClose(tomo.Stop)
|
window.OnClose(tomo.Stop)
|
||||||
window.Show()
|
window.Show()
|
||||||
|
Reference in New Issue
Block a user