Oh nice ! So there's more clojuredev users than the ones having subscribed to the clojuredev-user ml :-)
Feel free to report bugs. I like them :-) Correcting a bug is like a step forward to perfection :-) :-) -- Laurent 2009/2/9 phtrivier <phtriv...@gmail.com> > > Oh, don't worry, I used clojuredev for this ;) I noticed a few bugs > here and there, by the way, so i'll have to find some time and > report / patch ... anyway on this topic you really have the same > probleme with java, except that propers tools just hide the hugly list > of import anyway. > > Cheers > PH > > On 9 fév, 15:08, Laurent PETIT <laurent.pe...@gmail.com> wrote: > > Since you say you're an Eclipse user, one answer could be : use > clojuredev > > (eclipse plugin supporting clojure development), > > > > and wait patiently for this feature to be included :-). > > > > More seriously : clojuredev, while still a baby compared to slime, has > some > > interesting features worth considering for current eclipse users : > > - syntax coloring + rainbow parens > > - namespace browser > > - REPL launcher > > - auto-compilation of files + problem markers (for compilation errors) > > - "survival kit" of keyboard shortcuts in the editor : top-level > > s-expression selection, send to REPL (current selection or top-level > > s-expression), compile file, ... > > > > Code completion and integration with the JDT are next on my todo list. It > > would be based on heuristics in a first time (deduction of the namespace > of > > a symbol by simple/naive detection of the ns of the file), but would work > > 95% (if not better) of the time, and then, when time permits, based on > real > > static analysis+dynamic analysis of code. > > > > By integration with the JDT, the automatic addition of imports is indeed > a > > really interesting feature I would like to add (I intend to first use a > lot > > clojure for replacing bits of java in existing java projects, so our > needs > > will match in this area :-). > > > > Cheers, > > > > -- > > Laurent > > > > 2009/2/9 phtrivier <phtriv...@gmail.com> > > > > > > > > > Hi everyone > > > > > first of all, this is my first post, so if I ask FAQs or deserve to > > > RTFM, please tell me. > > > > > I am learning clojure, and trying to adapt some game code written in a > > > Java framework called Slick. After a couple of beginner's mistake (the > > > kind you do to learn ;) ), I got a working convestion of a Scoller > > > example. Still, there are some things that I don't find very elegant, > > > or where I'm pretty sure to be reinventing some wheel. > > > > > Code is here : > > > > >http://tinyurl.com/dj4l9z > > > or > > > git://github.com/phtrivier/clj-slick-tank.git > > > > > * The game is tile-based. I need to build up a collision map ("can the > > > tank walk on cell [3,2] ?"). Java does it with a two-dimensional array > > > of booleans. From discussion here : > > > > >http://groups.google.com/group/clojure/browse_thread/thread/5eb78c620. > .. > > > , I choosed to use a vector of vector (i probably should'nt have, but > > > that's another point). I wrote this : > > > > > (defn blocked? > > > "Is a position blocked in the screen?" > > > [screen x y] > > > (let [i (int x) > > > j (int y)] > > > (true? (get (get (screen :blocked) i) j)))) > > > > > (defn make-row-generator > > > [cell-generator w] > > > (fn [i] > > > (vec (map (fn [j] (cell-generator i j)) > > > (range 0 w))))) > > > > > (defn make-matrix > > > [w h cell-generator] > > > (vec (map (make-row-generator cell-generator w) > > > (range 0 h)))) > > > > > (defn make-collision-map > > > "Builds a double dimensioned array telling > > > whether a cell is blocked" > > > [m w h] > > > (make-matrix > > > w h > > > (fn [i j] > > > (let [tileId (.getTileId m i j 0)] > > > (let [res > > > (Boolean/parseBoolean > > > (.getTileProperty m tileId "blocked" "false"))] > > > res > > > ))))) > > > > > (the 'm' is a slick-specific stucture that holds the tile map). > > > Am I duplicating some existing library to build matrices ? Is there a > > > cleaner way to do it ? > > > > > * In a method I check for collisions : > > > > > ;; Movement > > > (defn try-move > > > "Try and move a player in the screen given a direction. > > > Returns a list with the moved player, and a > > > boolean indicating whether the move was successfull. > > > " > > > [player screen dx dy] > > > (let [new_x (+ (player :x) dx) > > > new_y (+ (player :y) dy)] > > > > > (let [bxy (blocked? screen new_x new_y) > > > bx (blocked? screen new_x (player :y)) > > > by (blocked? screen (player :x) new_y)] > > > (if bxy > > > (if bx > > > (if by > > > [player, false] > > > [(assoc player :y new_y), true]) > > > [(assoc player :x new_x), true]) > > > [(assoc player :x new_x :y new_y), true])))) > > > > > Will i get used to the nested 'if' blocks someday ? Any way to write > > > the equivalent of a switch case here, if only to improve > > > readibility ? > > > > > * Finally, my code starts with a rather ugly > > > > > (ns tank > > > (:import (org.newdawn.slick Animation > > > AppGameContainer > > > BasicGame > > > GameContainer > > > Graphics > > > Input > > > SlickException > > > SpriteSheet) > > > (org.newdawn.slick.tiled TiledMap) > > > (org.newdawn.slick.util Log))) > > > > > I know there is no way to import org.newdawn.slick.* (as discussed > > > here : > > > > >http://groups.google.com/group/clojure/browse_thread/thread/fa00a0ff4. > .. > > > ). What do you do in programs that need huge list of imports ? I'm > > > kinda spoiled by the Eclipse way of doing this, which is roughly : > > > import everything, forget about it, and let you IDE clear up the list. > > > And at least for development part it make things easier. If I hadn't > > > had the exact list of import to copy paste in this case, I would > > > probably have gone bored and depressed by the second class to import > > > manually (lazyness is not only for evaluation ;) ) > > > > > Thanks for any ideas, sorry if post is too long / newbie-like. > > > > > Cheers > > > PH > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---