Skip to content

Commit f5b892a

Browse files
dependencies updated for Beta 5
fixes to Snake
1 parent 584b9e1 commit f5b892a

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

README

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ DEPENDENCIES
99

1010
This version of the sample code has been tested with:
1111

12-
Clojure SVN revision 1195
13-
svn co -r 1195 http://clojure.googlecode.com/svn/trunk/ clojure
12+
Clojure SVN revision 1205
13+
svn co -r 1205 http://clojure.googlecode.com/svn/trunk/ clojure
1414

15-
Clojure-Contrib SVN revision 335:
16-
svn co -r 335 http://clojure-contrib.googlecode.com/svn/trunk/ clojure-contrib
15+
Clojure-Contrib SVN revision 368:
16+
svn co -r 368 http://clojure-contrib.googlecode.com/svn/trunk/ clojure-contrib
1717

1818
-------------------------------------------------------------------------------
1919
You can run the completed Compojure example with

examples/snake.clj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
; part of normal Clojure style
77

88
(ns examples.snake
9-
(:import (java.awt Color) (javax.swing JPanel JFrame Timer JOptionPane)
9+
(:import (java.awt Color Dimension)
10+
(javax.swing JPanel JFrame Timer JOptionPane)
1011
(java.awt.event ActionListener KeyListener))
1112
(:use clojure.contrib.import-static
1213
[clojure.contrib.seq-utils :only (includes?)]))
@@ -69,8 +70,7 @@
6970

7071
; START: lose?
7172
(defn head-overlaps-body? [{[head & body] :body}]
72-
; have proposed to SS that argument order be reversed:
73-
(includes? head body))
73+
(includes? body head))
7474

7575
(def lose? head-overlaps-body?)
7676
; END: lose?
@@ -144,6 +144,9 @@
144144
(.repaint this))
145145
(keyPressed [e] ; <label id="code.game-panel.keyPressed"/>
146146
(update-direction snake (dirs (.getKeyCode e))))
147+
(getPreferredSize []
148+
(Dimension. (* (inc width) point-size)
149+
(* (inc height) point-size)))
147150
(keyReleased [e])
148151
(keyTyped [e])))
149152
; END: game-panel
@@ -160,7 +163,7 @@
160163
(.addKeyListener panel))
161164
(doto frame ; <label id="code.game.frame"/>
162165
(.add panel)
163-
(.setSize (* width point-size) (* height point-size))
166+
(.pack)
164167
(.setVisible true))
165168
(.start timer) ; <label id="code.game.timer"/>
166169
[snake, apple, timer])) ; <label id="code.game.return"/>

lib/clojure-contrib.jar

18 KB
Binary file not shown.

lib/clojure.jar

4.98 KB
Binary file not shown.

lib/compojure.jar

48.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)