(app-settings load-defaults?
&
{:keys [fullscreen? vsync? width height frequency title frame-rate
resizable?]})
Creates an AppSettings instance.
Creates an AppSettings instance.
(app-state kw & {:keys [init update on-enable on-disable cleanup]})
AppState represents continuously executing code inside the main loop.
e.g.: (app-state ::my-app-state :init (fn [] (println "App State initialized.")) :update (fn [tpf] (println "update:" tpf)) :on-enable (fn [] (println "on enable")) :on-disable (fn [] (println "on disable")) :cleanup (fn [] (println "cleaning")))
If any function returns a hash map, the hash map will be registered to the mutable global state under app-states entry.
Please have a look AppState and BaseAppState for more.
AppState represents continuously executing code inside the main loop. e.g.: (app-state ::my-app-state :init (fn [] (println "App State initialized.")) :update (fn [tpf] (println "update:" tpf)) :on-enable (fn [] (println "on enable")) :on-disable (fn [] (println "on disable")) :cleanup (fn [] (println "cleaning"))) If any function returns a hash map, the hash map will be registered to the mutable global state under app-states entry. Please have a look AppState and BaseAppState for more.
(call* obj kw & args)
Java interop for methods. Since we can't wrap all functions of jMonkeyEngine, we can use a shortcut like this.
e.g.: (call* player :jump (vec3 0 20 0)) -> (.jump player (vec3 0 20 0))
Java interop for methods. Since we can't wrap all functions of jMonkeyEngine, we can use a shortcut like this. e.g.: (call* player :jump (vec3 0 20 0)) -> (.jump player (vec3 0 20 0))
(clear app)
Detaches all child nodes and removes all local lights from the root node.
Detaches all child nodes and removes all local lights from the root node.
(control kw & {:keys [update render]})
Controls are used to specify certain update and render logic for a Spatial.
If any function returns a hash map, the hash map will be registered to the mutable global state under controls entry.
(control ::my-control :update (fn [tpf] (println "update" tpf)) :render (fn [rm vp] (println "render" rm vp)))
Please have a look Control and AbstractControl for more.
Controls are used to specify certain update and render logic for a Spatial. If any function returns a hash map, the hash map will be registered to the mutable global state under controls entry. (control ::my-control :update (fn [tpf] (println "update" tpf)) :render (fn [rm vp] (println "render" rm vp))) Please have a look Control and AbstractControl for more.
(defsimpleapp name & {:keys [opts init update]})
Creates a SimpleApplication instance and binds with given name. Requires 3 parameters besides name. init (initialize fn, required) update (update fn, optional) opts (app settings, optional)
e.g.: (defsimpleapp app :opts {:show-settings? false :pause-on-lost-focus? false :settings {:title "My JME Game" :load-defaults? true :frame-rate 60}} :init init :update simple-update)
When init fn returns a hash map, this map registered to the mutable global state so it can be accessed from update fn and other fns. Also, this applies for the update fn, it's content merged to the mutable global state.
For other settings options, please have a look app-settings
fn.
It's not recommended to create multiple defsimpleapp instances inside one JVM. Some odd behaviours might occur due to shared states. Please run new JVM instance per application.
If you would like to run another SimpleApplication instance inside the same JVM (same REPL),
an option could be using unbind-app
for unbinding current app (var), and re-defining app with defsimpleapp
.
Please have a look at com.jme3.app.SimpleApplication for more.
Creates a SimpleApplication instance and binds with given name. Requires 3 parameters besides name. init (initialize fn, required) update (update fn, optional) opts (app settings, optional) e.g.: (defsimpleapp app :opts {:show-settings? false :pause-on-lost-focus? false :settings {:title "My JME Game" :load-defaults? true :frame-rate 60}} :init init :update simple-update) When init fn returns a hash map, this map registered to the mutable global state so it can be accessed from update fn and other fns. Also, this applies for the update fn, it's content merged to the mutable global state. For other settings options, please have a look `app-settings` fn. It's not recommended to create multiple defsimpleapp instances inside one JVM. Some odd behaviours might occur due to shared states. Please run new JVM instance per application. If you would like to run another SimpleApplication instance inside the same JVM (same REPL), an option could be using `unbind-app` for unbinding current app (var), and re-defining app with `defsimpleapp`. Please have a look at com.jme3.app.SimpleApplication for more.
(get* obj kw & args)
Java interop for methods with get
prefix.
e.g.: (get* (cam) :rotation) -> (.getRotation (cam))
Java interop for methods with `get` prefix. e.g.: (get* (cam) :rotation) -> (.getRotation (cam))
(get-main-state)
Returns the mutable global state map.
Returns the mutable global state map.
A list of SimpleApplication instances created with defsimpleapp
.
A list of SimpleApplication instances created with `defsimpleapp`.
(letj bindings & body)
Executes the body and returns a hash map with key-val pairs that extracted from bindings. Ignores _
bindings.
e.g.: (letj [shootables (node "Shootables") _ (init-keys) _ (init-cross-hairs) mark (init-mark)] (-> shootables (add-to-root) (attach-child (make-cube "the Deputy" 1 0 -4)) (attach-child (make-floor)) (attach-child (make-char))))
=> {:mark mark :shootables shootables}
Executes the body and returns a hash map with key-val pairs that extracted from bindings. Ignores `_` bindings. e.g.: (letj [shootables (node "Shootables") _ (init-keys) _ (init-cross-hairs) mark (init-mark)] (-> shootables (add-to-root) (attach-child (make-cube "the Deputy" 1 0 -4)) (attach-child (make-floor)) (attach-child (make-char)))) => {:mark mark :shootables shootables}
(add this v)
(add this x y)
(add this x y z)
(add-loc this v)
(add-loc this x y z)
(mult this scalar)
(mult-loc this scalar)
(negate this)
(setv this v)
(setv this x y)
(setv this x y z)
(raw-input-listener &
{:keys [begin-input end-input on-joy-axis-event
on-joy-button-event on-mouse-motion-event
on-mouse-button-event on-key-event on-touch-event]})
(re-init init-fn)
Re-initializes the app with given init fn. It does not stop the app. Can be used when new code changes needed for the init fn.
Re-initializes the app with given init fn. It does not stop the app. Can be used when new code changes needed for the init fn.
(run app & body)
Every code that changes the state should be wrapped with run
macro.
Otherwise Make sure you do not modify the scene from another thread!
exception will be thrown.
Every code that changes the state should be wrapped with `run` macro. Otherwise `Make sure you do not modify the scene from another thread!` exception will be thrown.
(set* obj kw & args)
Java interop for methods with set
prefix. Since it returns the given object,
this fn can be chained with other set*
s using the thread-first ->
macro.
e.g.: (set* channel :speed 1.0) -> (.setSpeed channel 1.0)
Java interop for methods with `set` prefix. Since it returns the given object, this fn can be chained with other `set*`s using the thread-first `->` macro. e.g.: (set* channel :speed 1.0) -> (.setSpeed channel 1.0)
(setc obj & args)
Compact version of set*
e.g.:
(setc debris
:material mat-debris
:images-x 3
:images-y 3
:rotate-speed 4
:select-random-image true
:start-color ColorRGBA/White
:gravity [0 6 0]
:low-life 1
:high-life 3)
When you need to pass multiple parameters, use a vector. e.g.: (setc :local-translation [0.0 -5.0 -2.0])
Compact version of `set*` e.g.: (setc debris :material mat-debris :images-x 3 :images-y 3 :rotate-speed 4 :select-random-image true :start-color ColorRGBA/White :gravity [0 6 0] :low-life 1 :high-life 3) When you need to pass multiple parameters, use a vector. e.g.: (setc :local-translation [0.0 -5.0 -2.0])
(start app)
Starts the SimpleApplication instance.
It's not recommended to call start
fn after calling stop
fn.
Some odd behaviours might occur such as JVM crash (based on the app, apps use Bullet API [not always]).
If you would like to re-start the app then use unbind-app
instead of stop
,
after re-defining app with defsimpleapp
then call start
again.
Starts the SimpleApplication instance. It's not recommended to call `start` fn after calling `stop` fn. Some odd behaviours might occur such as JVM crash (based on the app, apps use Bullet API [not always]). If you would like to re-start the app then use `unbind-app` instead of `stop`, after re-defining app with `defsimpleapp` then call `start` again.
The mutable global state of the application. It keeps app, app-state, control states and others.
The mutable global state of the application. It keeps app, app-state, control states and others.
(stop app)
Stops the SimpleApplication instance. Can be used when the user wants to exit from the game.
It's not recommended to call start
fn after calling stop
fn.
Some odd behaviours might occur such as JVM crash (based on the app, apps use Bullet API [not always]).
If you would like to re-start the app then use unbind-app
instead of stop
,
after re-defining app with defsimpleapp
then call start
again.
Stops the SimpleApplication instance. Can be used when the user wants to exit from the game. It's not recommended to call `start` fn after calling `stop` fn. Some odd behaviours might occur such as JVM crash (based on the app, apps use Bullet API [not always]). If you would like to re-start the app then use `unbind-app` instead of `stop`, after re-defining app with `defsimpleapp` then call `start` again.
(unbind-all)
Unbinds all SimpleApplication instances from the vars. Should be used for development purposes only. Can be used for some leftover instances in the REPL.
e.g.: (unbind-all)
After calling unbind-all
, app
can be re-defined with defsimpleapp
.
Unbinds all SimpleApplication instances from the vars. Should be used for development purposes only. Can be used for some leftover instances in the REPL. e.g.: (unbind-all) After calling `unbind-all`, `app` can be re-defined with `defsimpleapp`.
(unbind-app v)
Unbinds the SimpleApplication instance from the var. Should be used for development purposes only.
e.g.: (unbind-app #'my-ns/app)
After calling unbind-app
, app
can be re-defined with defsimpleapp
.
Unbinds the SimpleApplication instance from the var. Should be used for development purposes only. e.g.: (unbind-app #'my-ns/app) After calling `unbind-app`, `app` can be re-defined with `defsimpleapp`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close