Mercurial > cortex
comparison org/world.org @ 66:1381a6ebd08b
updated org files to work with latest org changes
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 07 Dec 2011 12:16:48 -0600 |
parents | 4b5f00110d8c |
children | 6f74d89fb8b3 |
comparison
equal
deleted
inserted
replaced
65:4b5f00110d8c | 66:1381a6ebd08b |
---|---|
44 - Separation of Object life-cycles with the Application life-cycle. | 44 - Separation of Object life-cycles with the Application life-cycle. |
45 - Functional interface to the underlying =Application= and | 45 - Functional interface to the underlying =Application= and |
46 =SimpleApplication= classes. | 46 =SimpleApplication= classes. |
47 | 47 |
48 ** Header | 48 ** Header |
49 #+srcname: header | 49 #+name: header |
50 #+begin_src clojure :results silent | 50 #+begin_src clojure :results silent |
51 (ns cortex.world | 51 (ns cortex.world |
52 "World Creation, abstracion over jme3's input system, and REPL | 52 "World Creation, abstracion over jme3's input system, and REPL |
53 driven exception handling" | 53 driven exception handling" |
54 {:author "Robert McIntyre"} | 54 {:author "Robert McIntyre"} |
55 | 55 |
56 (:use (clojure.contrib (def :only (defvar)))) | 56 (:use (clojure.contrib (def :only (defvar defn-memo)))) |
57 (:use [clojure.contrib [str-utils :only [re-gsub]]]) | 57 (:use [clojure.contrib [str-utils :only [re-gsub]]]) |
58 | 58 |
59 (:import com.aurellem.capture.IsoTimer) | 59 (:import com.aurellem.capture.IsoTimer) |
60 | 60 |
61 (:import com.jme3.math.Vector3f) | 61 (:import com.jme3.math.Vector3f) |
69 (:import com.jme3.bullet.BulletAppState) | 69 (:import com.jme3.bullet.BulletAppState) |
70 (:import com.jme3.shadow.BasicShadowRenderer) | 70 (:import com.jme3.shadow.BasicShadowRenderer) |
71 (:import com.jme3.app.SimpleApplication) | 71 (:import com.jme3.app.SimpleApplication) |
72 (:import com.jme3.input.controls.ActionListener) | 72 (:import com.jme3.input.controls.ActionListener) |
73 (:import com.jme3.renderer.queue.RenderQueue$ShadowMode) | 73 (:import com.jme3.renderer.queue.RenderQueue$ShadowMode) |
74 (:import org.lwjgl.input.Mouse)) | 74 (:import org.lwjgl.input.Mouse) |
75 (:import com.aurellem.capture.AurellemSystemDelegate)) | |
76 | |
75 #+end_src | 77 #+end_src |
76 | 78 |
77 ** General Settings | 79 ** General Settings |
78 #+srcname: settings | 80 #+name: settings |
79 #+begin_src clojure | 81 #+begin_src clojure |
80 (in-ns 'cortex.world) | 82 (in-ns 'cortex.world) |
81 | 83 |
82 (defvar *app-settings* | 84 (defvar *app-settings* |
83 (doto (AppSettings. true) | 85 (doto (AppSettings. true) |
103 independent from any particular application. =(asset-manager)= makes | 105 independent from any particular application. =(asset-manager)= makes |
104 object creation less tightly bound to a particular Application | 106 object creation less tightly bound to a particular Application |
105 Instance. | 107 Instance. |
106 | 108 |
107 ** Exception Protection | 109 ** Exception Protection |
108 #+srcname: exceptions | 110 #+name: exceptions |
109 #+begin_src clojure | 111 #+begin_src clojure |
110 (in-ns 'cortex.world) | 112 (in-ns 'cortex.world) |
111 | 113 |
112 (defmacro no-exceptions | 114 (defmacro no-exceptions |
113 "Sweet relief like I never knew." | 115 "Sweet relief like I never knew." |
136 is possible to just exit the faulty Application, fix the bug, | 138 is possible to just exit the faulty Application, fix the bug, |
137 reevaluate the appropriate forms, and be on your way, without | 139 reevaluate the appropriate forms, and be on your way, without |
138 restarting the JVM. | 140 restarting the JVM. |
139 | 141 |
140 ** Input | 142 ** Input |
141 #+srcname: input | 143 #+name: input |
142 #+begin_src clojure | 144 #+begin_src clojure |
143 (in-ns 'cortex.world) | 145 (in-ns 'cortex.world) |
144 | 146 |
145 (defn static-integer? | 147 (defn static-integer? |
146 "does the field represent a static integer constant?" | 148 "does the field represent a static integer constant?" |
190 ^InputManager input-manager game | 192 ^InputManager input-manager game |
191 (into-array String [name]))) (keys key-map)))) | 193 (into-array String [name]))) (keys key-map)))) |
192 | 194 |
193 #+end_src | 195 #+end_src |
194 | 196 |
197 #+results: input | |
198 : #'cortex.world/initialize-inputs | |
199 | |
195 These functions are for controlling the world through the keyboard and | 200 These functions are for controlling the world through the keyboard and |
196 mouse. | 201 mouse. |
197 | 202 |
198 =constant-map= gets the numerical values for all the keys defined in | 203 =constant-map= gets the numerical values for all the keys defined in |
199 the =KeyInput= class. | 204 the =KeyInput= class. |
224 : ["key-f8" #<KeyTrigger com.jme3.input.controls.KeyTrigger@24f97188>] | 229 : ["key-f8" #<KeyTrigger com.jme3.input.controls.KeyTrigger@24f97188>] |
225 : ["key-o" #<KeyTrigger com.jme3.input.controls.KeyTrigger@685c53ff>] | 230 : ["key-o" #<KeyTrigger com.jme3.input.controls.KeyTrigger@685c53ff>] |
226 : ["key-at" #<KeyTrigger com.jme3.input.controls.KeyTrigger@4c3e2e5f>]) | 231 : ["key-at" #<KeyTrigger com.jme3.input.controls.KeyTrigger@4c3e2e5f>]) |
227 | 232 |
228 ** World Creation | 233 ** World Creation |
229 #+srcname: world | 234 #+name: world |
230 #+begin_src clojure :results silent | 235 #+begin_src clojure :results silent |
231 (in-ns 'cortex.world) | 236 (in-ns 'cortex.world) |
232 | 237 |
233 (defn no-op | 238 (defn no-op |
234 "Takes any number of arguments and does nothing." | 239 "Takes any number of arguments and does nothing." |
324 (react this value))))) | 329 (react this value))))) |
325 ;; don't show a menu to change options. | 330 ;; don't show a menu to change options. |
326 (.setShowSettings false) | 331 (.setShowSettings false) |
327 ;; continue running simulation even if the window has lost | 332 ;; continue running simulation even if the window has lost |
328 ;; focus. | 333 ;; focus. |
334 (JmeSystem/setSystemDelegate (AurellemSystemDelegate.)) | |
329 (.setPauseOnLostFocus false) | 335 (.setPauseOnLostFocus false) |
330 (.setSettings *app-settings*)))) | 336 (.setSettings *app-settings*)))) |
331 #+end_src | 337 #+end_src |
332 | 338 |
333 | 339 |