             [con-world.cell :as cell]
             [con-world.utils :as u]))
 
-(declare main-screen con-world)
+(declare main-screen con-world intro-screen game-over-screen)
 
 (defn in-rectangle? [{:keys [x y width height]} r]
   (and (rectangle! r :contains x y) (rectangle! r :contains (+ x width) (+ y height))))

          (assoc entity :in-zone? true))
        entity))
    entity))

(defscreen main-screen
           :on-show

                 (.setEnabled contact false))
               entities)))

(defscreen intro-screen
           :on-show
           (fn [screen _]
             (update! screen :renderer (stage) :camera (orthographic))
             (label "Tu veux jouer avec des spores et des arbres ?" (color :green)))

           :on-render
           (fn [screen entities]
             (clear! 0 0 0 1)
             (render! screen entities))

           :on-key-down
           (fn [_ entities]
             (set-screen! con-world main-screen)
             entities)

           :on-resize
           (fn [screen entities]
             (size! screen (game :width) (game :height))
             entities))

(defscreen game-over-screen
           :on-show
           (fn [screen _]
             (update! screen :renderer (stage) :camera (orthographic))
             (label "Game over" (color :red)))

           :on-render
           (fn [screen entities]
             (clear! 0 0 0 1)
             (render! screen entities))

           :on-key-down
           (fn [_ entities]
             (set-screen! con-world main-screen)
             entities)

           :on-resize
           (fn [screen entities]
             (size! screen (game :width) (game :height))
             entities))

(defgame con-world
         :on-create
         (fn [this]
           (set-screen! this intro-screen)))
