mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-11 20:49:05 +03:00
23 lines
732 B
Plaintext
23 lines
732 B
Plaintext
(Debug.sanitize-addresses)
|
|
(Project.config "print-ast" true)
|
|
|
|
(load "SDL.carp")
|
|
|
|
(defn handle-events [app]
|
|
(let [event (SDL.event-init)]
|
|
(while (SDL.poll-event (address event))
|
|
(let [et (SDL.event-type &event)]
|
|
(cond (= et SDL.QUIT) (System.exit 0)
|
|
(= et SDL.KEYDOWN) (let [key (SDL.event-keycode &event)]
|
|
(cond
|
|
(= key SDL.key-escape) (System.exit 0)
|
|
(IO.println "Unrecognized key.")))
|
|
(IO.println "Some other event happened..."))))))
|
|
|
|
(defn main []
|
|
(let [app (SDLApp.start "Temp" 400 300)]
|
|
(while true
|
|
(do
|
|
(handle-events &app)
|
|
(SDL.Delay 30)))))
|