changeset 320:52de8a36edde

removed last vestiges of clojure.contrib
author Robert McIntyre <rlm@mit.edu>
date Thu, 01 Mar 2012 06:24:17 -0700
parents b84701e4f6ae
children 702b5c78c2de
files org/util.org org/world.org
diffstat 2 files changed, 23 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/org/util.org	Thu Mar 01 05:56:52 2012 -0700
     1.2 +++ b/org/util.org	Thu Mar 01 06:24:17 2012 -0700
     1.3 @@ -104,11 +104,11 @@
     1.4    (:import com.jme3.scene.plugins.blender.BlenderModelLoader)
     1.5    (:import (java.util.logging Level Logger)))
     1.6  
     1.7 -(defvar println-repl
     1.8 -  (bound-fn [& args] (apply println args))
     1.9 +(def println-repl
    1.10    "println called from the LWJGL thread will not go to the REPL, but
    1.11     instead to whatever terminal started the JVM process. This function
    1.12 -   will always output to the REPL")
    1.13 +   will always output to the REPL"
    1.14 +  (bound-fn [& args] (apply println args)))
    1.15  
    1.16  (defn position-camera
    1.17    "Change the position of the in-world camera."
    1.18 @@ -250,23 +250,23 @@
    1.19     GImpact?
    1.20     ])
    1.21  
    1.22 -(defvar base-shape
    1.23 -     (shape-description.
    1.24 -      "default-shape"
    1.25 -      false
    1.26 -      ;;ColorRGBA/Blue
    1.27 -      1.0 ;; mass
    1.28 -      1.0 ;; friction
    1.29 -      ;; texture
    1.30 -      "Textures/Terrain/BrickWall/BrickWall.jpg"
    1.31 -      ;; material
    1.32 -      "Common/MatDefs/Misc/Unshaded.j3md"
    1.33 -      Vector3f/ZERO
    1.34 -      Quaternion/IDENTITY
    1.35 -      (Box. Vector3f/ZERO 0.5 0.5 0.5)
    1.36 -      true
    1.37 -      false)
    1.38 -     "Basic settings for shapes.")
    1.39 +(def base-shape
    1.40 +  "Basic settings for shapes."
    1.41 +  (shape-description.
    1.42 +   "default-shape"
    1.43 +   false
    1.44 +   ;;ColorRGBA/Blue
    1.45 +   1.0 ;; mass
    1.46 +   1.0 ;; friction
    1.47 +   ;; texture
    1.48 +   "Textures/Terrain/BrickWall/BrickWall.jpg"
    1.49 +   ;; material
    1.50 +   "Common/MatDefs/Misc/Unshaded.j3md"
    1.51 +   Vector3f/ZERO
    1.52 +   Quaternion/IDENTITY
    1.53 +   (Box. Vector3f/ZERO 0.5 0.5 0.5)
    1.54 +   true
    1.55 +   false))
    1.56  
    1.57  (defn make-shape
    1.58    [#^shape-description d]
     2.1 --- a/org/world.org	Thu Mar 01 05:56:52 2012 -0700
     2.2 +++ b/org/world.org	Thu Mar 01 06:24:17 2012 -0700
     2.3 @@ -53,9 +53,6 @@
     2.4    driven exception handling"
     2.5    {:author "Robert McIntyre"}
     2.6    
     2.7 -  (:use (clojure.contrib (def :only (defn-memo))))
     2.8 -  (:use [clojure.contrib [str-utils :only [re-gsub]]])
     2.9 -
    2.10    (:import com.aurellem.capture.IsoTimer)
    2.11  
    2.12    (:import com.jme3.math.Vector3f)
    2.13 @@ -153,7 +150,7 @@
    2.14  (defn integer-constants [class]
    2.15    (filter static-integer? (.getFields class)))
    2.16  
    2.17 -(defn-memo constant-map
    2.18 +(defn constant-map
    2.19    "Takes a class and creates a map of the static constant integer
    2.20    fields with their names.  This helps with C wrappers where they have
    2.21    just defined a bunch of integer constants instead of enums"
    2.22 @@ -162,6 +159,7 @@
    2.23         (into (sorted-map)
    2.24  	     (zipmap (map #(.get % nil) integer-fields)
    2.25  		     (map #(.getName %) integer-fields)))))
    2.26 +(alter-var-root #'constant-map memoize)
    2.27  
    2.28  (defn all-keys
    2.29    "Uses reflection to generate a map of string names to jme3 trigger
    2.30 @@ -170,7 +168,7 @@
    2.31    (let [inputs (constant-map KeyInput)]
    2.32      (assoc
    2.33  	(zipmap (map (fn [field]
    2.34 -		       (.toLowerCase (re-gsub #"_" "-" field))) (vals inputs))
    2.35 +		       (.toLowerCase (.replaceAll field "_" "-"))) (vals inputs))
    2.36  		(map (fn [val] (KeyTrigger. val)) (keys inputs)))
    2.37        ;;explicitly add mouse controls
    2.38        "mouse-left" (MouseButtonTrigger. 0)