Skip to content

Instantly share code, notes, and snippets.

@Makman2
Created March 14, 2016 00:47
Show Gist options
  • Save Makman2/d66a3ab719e9f728e968 to your computer and use it in GitHub Desktop.
Save Makman2/d66a3ab719e9f728e968 to your computer and use it in GitHub Desktop.
My first try to get jmonkeyengine running with scala
package coz
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;
/** Sample 1 - how to get started with the most simple JME 3 application.
* Display a blue 3D cube and view from all sides by
* moving the mouse and pressing the WASD keys. */
class Application extends SimpleApplication
{
override def simpleInitApp()
{
var b = new Box(1, 1, 1); // create cube shape
var geom = new Geometry("Box", b); // create cube geometry from the shape
var mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material
mat.setColor("Color", ColorRGBA.Blue); // set color of material to blue
geom.setMaterial(mat); // set the cube's material
rootNode.attachChild(geom); // make the cube appear in the scene
}
}
import coz.Application
object Main extends App
{
var app = new Application();
app.start();
}
SRC=`echo Main.scala Application.scala`
CLASSPATH="\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/eventbus.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/gluegen-rt.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jglfont-core.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jinput.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-android.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-blender.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-bullet.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-bullet-natives-android.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-core.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-desktop.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-effects.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-ios.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-jbullet.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-jogg.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-jogl.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-lwjgl.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-lwjgl-natives.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-networking.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-niftygui.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-openal-soft-natives-android.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-plugins.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-terrain.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jME3-testdata.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/joal.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/j-ogg-oggd.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/j-ogg-vorbisd.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/jogl-all.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/launch4j.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/lwjgl.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/nifty-default-controls.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/nifty-default-controls-javadoc.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/nifty.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/nifty-javadoc.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/nifty-style-black.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/proguard.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/retrace.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/stack-alloc.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/vecmath.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/xmlpull-xpp3.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/libs/xstream.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-android.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-angelfont.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-assetpack.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-blender.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-cinematics.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-codecheck.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-codepalette.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-core-baselibs.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-core.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-core-libraries.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-core-updatecenters.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-desktop-executables.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-docs.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-gui.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-lwjgl-applet.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-materials.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-modelimporter.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-nmgen.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-obfuscate.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-ogretools.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-ogrexml.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-project-baselibs.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-project-libraries.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-project-testdata.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-scenecomposer.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-templates.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-templates-tests.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-terraineditor.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-textureeditor.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-upgrader.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-vehiclecreator.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-wavefront.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/com-jme3-gde-welcome.jar:\
/home/mak/jmonkeyplatform/jmonkeyplatform/modules/net-java-nboglpack-glsleditor.jar"
case $1 in
"build")
mkdir -p build
scalac -classpath "$CLASSPATH" -d build/ $SRC;;
"run")
scala -classpath "$CLASSPATH:build" Main;;
*)
echo "Invalid target specified.";;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment