Re: Tron clone in Clojure
Here's a 2D game I wrote in Clojure for comparision: http://github.com/ShardPhoenix/SAGame This was my first significant Clojure program so the code is a bit rough, but the core game state is handled in a pure-functional way, and is continuously passed around the main loop. -- Ryan Sattler -- 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 Note that posts from new members are moderated - please be patient with your first post. 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
Re: why not change > < type compare functions do a compare on strings as well?
I'd be highly dubious of this even if it was free, performance-wise. > and < are not clearly defined on strings and in general this kind of thing seems like an inroad for the kind of baffling implicit conversion-type behaviours you can see in PHP or JavaScript. Functions that do something like those in the OP might be useful, but they should be named something that doesn't carry so much intuitive baggage already. -- Ryan Sattler -- 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 Note that posts from new members are moderated - please be patient with your first post. 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
Re: java gui is flashing
I've been working on a game with Clojure/Swing lately and the simplest way to avoid flashing is to draw to a bufferedImage first, then draw that bufferedImage all at once. This means that parts of the screen that don't change won't be briefly overwritten by the background color, avoiding flashing. Here's some code: (defn render [game window] (let [#^BufferedImage image (.createImage window window-width window- height) #^Graphics gfx (.createGraphics image) #^Graphics2D gfx2 (.getGraphics #^JFrame window)] (render-background gfx) ;draw more stuff on gfx here, eg, your draw-boid would go here (.drawImage gfx2 image 0 0 window))) ;finally draws the buffered image to the screen all at once -- Ryan Sattler -- 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 Note that posts from new members are moderated - please be patient with your first post. 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