siam-farmer/src/game.clj

41 lines
822 B
Clojure

(ns game
(:require
[engine]
[rl :as rl]))
(set! *warn-on-reflection* true)
;; (set! *unchecked-math* :warn-on-boxed)
(defn init-game [config]
{:color-idx 0})
(defn handle-game-input [config game]
(when (rl/key-pressed? rl/key-r))
(when (rl/mouse-button-down? rl/mouse-button-left))
game)
(defn update-game [config game]
game)
(defn draw-game [config game]
(rl/clear-background!* rl/cornflower-blue))
(defn watch-game [config game]
{:color-idx (:color-idx game)})
(defn -main [& _args]
(engine/run-game!
{:title "Siam Farmer"
:width 900
:height 500
:config-path "game-config.edn"
:init #'init-game
:input #'handle-game-input
:update #'update-game
:draw #'draw-game
:watch-fn #'watch-game}))
(comment
;;
:-)