Added d-pad functionality

This commit is contained in:
Daniel Ziltener 2024-10-21 12:17:21 +02:00
parent 33b3016b88
commit 87d001fa03
Signed by: zilti
GPG key ID: B38976E82C9DAE42
2 changed files with 8 additions and 5 deletions

View file

@ -12,9 +12,6 @@
(prefix sdl2-image "img:") (prefix sdl2-image "img:")
(prefix sdl2-ttf "ttf:")) (prefix sdl2-ttf "ttf:"))
(change-directory
(irregex-match-substring (irregex-search '(: bos (* any) #\/) (executable-pathname))))
;;; Configuration Handling ;;; Configuration Handling
(define tomldata (table-from-file "menu.toml")) (define tomldata (table-from-file "menu.toml"))
@ -175,7 +172,9 @@
active-button-id)))) active-button-id))))
((controller-button-down) (begin ((controller-button-down) (begin
(case (sdl2:controller-button-event-button ev) (case (sdl2:controller-button-event-button ev)
((a) (trigger-action! window))) ((a) (trigger-action! window))
((dpad-left) (change-active-button -1))
((dpad-right) (change-active-button 1)))
(set! debugtext (format "Controller button: ~A" (set! debugtext (format "Controller button: ~A"
(sdl2:controller-button-event-button ev))))) (sdl2:controller-button-event-button ev)))))
((key-down) (set! debugtext "Event: Key down")) ((key-down) (set! debugtext "Event: Key down"))

View file

@ -1,6 +1,10 @@
(module (menu) (module (menu)
() ()
(import (scheme) (import (scheme)
(chicken base)) (chicken base)
(chicken irregex)
(chicken process-context))
(include-relative "./menu-impl.scm") (include-relative "./menu-impl.scm")
(change-directory
(irregex-match-substring (irregex-search '(: bos (* any) #\/) (executable-pathname))))
(main)) (main))