Created
August 19, 2018 13:45
-
-
Save lbighetti/1e6b18cdc190eb32ec063e67198dcbf8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; helloworld example | |
(define ahooga #f) | |
(define gui #f) | |
(define timewheel #f) | |
(define (button-callback g w t x y) | |
(let ((oldcolor (glgui-widget-get g w 'color))) | |
(if ahooga (audiofile-play ahooga)) | |
(glgui-widget-set! g w 'color (if (= oldcolor White) Red White)) | |
) | |
) | |
(main | |
;; initialization | |
(lambda (w h) | |
(make-window 320 480) | |
(glgui-orientation-set! GUI_PORTRAIT) | |
(set! gui (make-glgui)) | |
(glgui-menubar gui 0 (- (glgui-height-get) 44) (glgui-width-get) 44) | |
(glgui-menubar gui 0 0 (glgui-width-get) 44) | |
(glgui-pixmap gui 8 (- (glgui-height-get) 32) title.img) | |
(let ((bw 150) (bh 50)) | |
(let ((bx (/ (- (glgui-width-get) bw) 2.)) | |
(by (/ (- (glgui-height-get) bh) 2.))) | |
(glgui-button-string gui bx by bw bh "Me too!!!" ascii_18.fnt button-callback)) | |
(let ((bx (- (glgui-width-get) bw 10)) (by (+ 44 10))) | |
(glgui-button-string gui bx by bw bh "And me!!" ascii_18.fnt button-callback)) | |
(let ((bx 10) (by (- (glgui-height-get) 44 10 bh))) | |
(glgui-button-string gui bx by bw bh "Push me!" ascii_18.fnt button-callback)) | |
) | |
(audiofile-init) | |
(set! ahooga (audiofile-load "ahooga")) | |
) | |
;; events | |
(lambda (t x y) | |
(if (= t EVENT_KEYPRESS) (begin | |
(if (= x EVENT_KEYESCAPE) (terminate)))) | |
(glgui-event gui t x y)) | |
;; termination | |
(lambda () #t) | |
;; suspend | |
(lambda () (glgui-suspend)) | |
;; resume | |
(lambda () (glgui-resume)) | |
) | |
;; eof |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment