editor-mode, draw when active, screen dim defs
This commit is contained in:
parent
a44a296296
commit
7044605f61
26
src/game.clj
26
src/game.clj
@ -3,22 +3,34 @@
|
||||
[engine]
|
||||
[rl :as rl]))
|
||||
|
||||
(def screen-width 900)
|
||||
(def screen-height 500)
|
||||
|
||||
(set! *warn-on-reflection* true)
|
||||
;; (set! *unchecked-math* :warn-on-boxed)
|
||||
|
||||
(defn init-game [config]
|
||||
{:color-idx 0})
|
||||
{:editor-mode false
|
||||
: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)
|
||||
(cond-> game
|
||||
(rl/key-pressed? rl/key-space)
|
||||
(update :editor-mode not)))
|
||||
|
||||
(defn update-game [config game]
|
||||
(if (:editor-mode game)
|
||||
()
|
||||
())
|
||||
game)
|
||||
|
||||
(defn draw-game [config game]
|
||||
(rl/clear-background!* rl/cornflower-blue))
|
||||
(rl/clear-background!* rl/cornflower-blue)
|
||||
(when (:editor-mode game)
|
||||
(rl/draw-rectangle!* 0 0 screen-width screen-height (rl/color-seg 0 0 0 100))
|
||||
(rl/draw-rectangle!* (/ screen-width 2) (/ screen-height 2) 100 100 rl/white)
|
||||
(rl/draw-text!* "EDIT MODE" (- screen-width 100) 10 16 rl/green)))
|
||||
|
||||
(defn watch-game [config game]
|
||||
{:color-idx (:color-idx game)})
|
||||
@ -26,8 +38,8 @@
|
||||
(defn -main [& _args]
|
||||
(engine/run-game!
|
||||
{:title "Siam Farmer"
|
||||
:width 900
|
||||
:height 500
|
||||
:width screen-width
|
||||
:height screen-height
|
||||
:config-path "game-config.edn"
|
||||
:init #'init-game
|
||||
:input #'handle-game-input
|
||||
@ -36,5 +48,5 @@
|
||||
:watch-fn #'watch-game}))
|
||||
|
||||
(comment
|
||||
;;
|
||||
(future (-main))
|
||||
:-)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user