don't cycle rapidly when held
This commit is contained in:
parent
dbbbceaa49
commit
87394e7263
|
@ -37,9 +37,9 @@ func handleWindowEvent(event *sdl.WindowEvent, m *milkDropWindow) {
|
||||||
|
|
||||||
func handleKeyboardEvent(event *sdl.KeyboardEvent, m *milkDropWindow) {
|
func handleKeyboardEvent(event *sdl.KeyboardEvent, m *milkDropWindow) {
|
||||||
scancode := event.Keysym.Scancode
|
scancode := event.Keysym.Scancode
|
||||||
if event.Type == sdl.KEYDOWN && scancode == sdl.SCANCODE_RIGHT {
|
if event.Type == sdl.KEYDOWN && scancode == sdl.SCANCODE_RIGHT && event.Repeat == 0 {
|
||||||
m.nextPreset()
|
m.nextPreset()
|
||||||
} else if event.Type == sdl.KEYDOWN && scancode == sdl.SCANCODE_LEFT {
|
} else if event.Type == sdl.KEYDOWN && scancode == sdl.SCANCODE_LEFT && event.Repeat == 0 {
|
||||||
m.prevPreset()
|
m.prevPreset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue