don't cycle rapidly when held

This commit is contained in:
filifa 2024-09-02 22:44:24 -05:00
parent dbbbceaa49
commit 87394e7263
1 changed files with 2 additions and 2 deletions

View File

@ -37,9 +37,9 @@ func handleWindowEvent(event *sdl.WindowEvent, m *milkDropWindow) {
func handleKeyboardEvent(event *sdl.KeyboardEvent, m *milkDropWindow) {
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()
} 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()
}
}