cycle in reverse with left

This commit is contained in:
filifa 2024-09-02 22:31:25 -05:00
parent 21c0e3f447
commit 9e8aff813e
2 changed files with 7 additions and 0 deletions

View File

@ -39,6 +39,8 @@ 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 {
m.nextPreset() m.nextPreset()
} else if event.Type == sdl.KEYDOWN && scancode == sdl.SCANCODE_LEFT {
m.prevPreset()
} }
} }

View File

@ -75,6 +75,11 @@ func (m *milkDropWindow) nextPreset() {
m.loadPreset(m.preset.Value.(string)) m.loadPreset(m.preset.Value.(string))
} }
func (m *milkDropWindow) prevPreset() {
m.preset = m.preset.Prev()
m.loadPreset(m.preset.Value.(string))
}
func newMilkDropWindow(width, height int32, scriptPath string) (*milkDropWindow, error) { func newMilkDropWindow(width, height int32, scriptPath string) (*milkDropWindow, error) {
var m milkDropWindow var m milkDropWindow
var err error var err error