Skip to content

Commit

Permalink
Defin things in a proper order
Browse files Browse the repository at this point in the history
  • Loading branch information
dsouth committed Sep 5, 2011
1 parent 583b5b1 commit 039bb6d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions clojure/SimpleRL.clj
Expand Up @@ -17,9 +17,8 @@

(def x (ref 5))
(def y (ref 5))

(defn refresh []
(.setText pane (str-world-with-hero)))
(def pane (JTextArea.))
(def frame (JFrame.))

(defn world-with-hero []
(let [x (deref x)
Expand All @@ -32,6 +31,9 @@
world-str (reduce str world-seq)]
world-str))

(defn refresh []
(.setText pane (str-world-with-hero)))

(defn move [dx dy]
(let [new-x (+ (deref x) dx)
new-y (+ (deref y) dy)]
Expand All @@ -50,9 +52,7 @@
(= key-code KeyEvent/VK_UP) (move 0 -1)
(= key-code KeyEvent/VK_DOWN) (move 0 1))))))

(def pane (JTextArea.))
(.addKeyListener pane listener)
(def frame (JFrame.))
(.setEditable pane false)
(.setFont pane (Font. "monospaced", Font/PLAIN 14))
(refresh)
Expand Down

0 comments on commit 039bb6d

Please sign in to comment.