Hello to community.
I'm trying to convert this "jMonkey Engine" java's code to Clojure:
.................................................................
public class TestSimpleGame extends SimpleGame {
public static void main(String[] args) {
TestSimpleGame app = new TestSimpleGame();
app.setConfigShowMode(ConfigShowMode.AlwaysShow);
app.start();
}
protected void simpleInitGame() {
display.setTitle("A Simple Test");
Box box = new Box("my box", new Vector3f(0, 0, 0), 2, 2, 2);
box.setModelBound(new BoundingSphere());
box.updateModelBound();
rootNode.attachChild(box);
}
}
..................................................................
ConfigShowMode is enum type:
public abstract class AbstractGame {
private static final Logger logger = Logger.getLogger
(AbstractGame.class
.getName());
public enum ConfigShowMode {
NeverShow,
AlwaysShow,
ShowIfNoConfig;
}
......................................................................
so my failure attempt was:
..................................................................
(ns jME-hello
(:import (com.jme.app SimpleGame AbstractGame)
(com.jme.math Vector3f)
(com.jme.scene.shape Box)))
(def b (Box. "My box" (Vector3f. 0 0 0)(Vector3f. 1 1 1)))
(def AShow (proxy [Enum] ["AlwaysShow" 1]))
(defn main []
(let [app (proxy [SimpleGame] []
(.simpleInitGame []
(. (proxy-super rootNoode) attachChild b)))]
(.setConfigShowMode app AShow)
(.start app)))
(main)
......................................................................
java.lang.ClassCastException: clojure.proxy.java.lang.Enum cannot be
cast to com.jme.app.AbstractGame$ConfigShowMode (NO_SOURCE_FILE:0)
[Thrown class clojure.lang.Compiler$CompilerException]
Obviously this is newbie problem,
and I made enum type according to previous mails.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---