Skip to content

Instantly share code, notes, and snippets.

@petrukhnov
Last active September 26, 2021 01:04
Show Gist options
  • Select an option

  • Save petrukhnov/f248db67b6b95730b5c953af21f7c971 to your computer and use it in GitHub Desktop.

Select an option

Save petrukhnov/f248db67b6b95730b5c953af21f7c971 to your computer and use it in GitHub Desktop.
jMonkeyengine gradle setup example
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'idea'
ext {
jmonkeyengine_version = '[3.1,)'
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
maven { url "https://jitpack.io" }
maven { url "http://nifty-gui.sourceforge.net/nifty-maven-repo" }
}
// NetBeans will automatically add "run" and "debug" tasks relying on the
// "mainClass" property. You may however define the property prior executing
// tasks by passing a "-PmainClass=<QUALIFIED_CLASS_NAME>" argument.
//
// Note however, that you may define your own "run" and "debug" task if you
// prefer. In this case NetBeans will not add these tasks but you may rely on
// your own implementation.
if (!hasProperty('mainClass')) {
ext.mainClass = 'petrukhnov.konstantin.games.snake.Main'
}
mainClassName = ext.mainClass
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task(debug, dependsOn: classes, type: JavaExec) {
main = getProperty('mainClass')
classpath = sourceSets.main.runtimeClasspath
if (project.hasProperty('args')) {
args(project.getAt('args').split(','))
}
standardInput = System.in
ignoreExitValue = true
debug true
}
artifacts {
archives sourcesJar
// archives javadocJar
}
dependencies {
compile fileTree(dir: 'lib', include: ['*.jar'])
compile "org.jmonkeyengine:jme3-core:$jmonkeyengine_version"
compile "org.jmonkeyengine:jme3-plugins:$jmonkeyengine_version"
compile "org.jmonkeyengine:jme3-effects:$jmonkeyengine_version"
compile "org.jmonkeyengine:jme3-networking:$jmonkeyengine_version"
compile "org.jmonkeyengine:jme3-blender:$jmonkeyengine_version"
compile "org.jmonkeyengine:jme3-bullet:$jmonkeyengine_version"
compile "org.jmonkeyengine:jme3-bullet-native:$jmonkeyengine_version"
compile "org.jmonkeyengine:jme3-lwjgl:$jmonkeyengine_version"
compile "org.jmonkeyengine:jme3-niftygui:$jmonkeyengine_version"
compile "com.badlogicgames.gdx:gdx-ai:1.8.0"
compile "javax.vecmath:vecmath:1.5.2"
compile "com.simsilica:zay-es:1.2.1"
compile "com.simsilica:zay-es-net:1.2.1"
}
eclipse {
classpath {
downloadSources=true
}
jdt {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
project {
natures 'org.springsource.ide.eclipse.gradle.core.nature'
}
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
compileJava {
sourceCompatibility = '1.8'
options.incremental = true
}
task wrapper(type: Wrapper) {
gradleVersion = '3.2.1'
}
package petrukhnov.konstantin.games.snake;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.scene.shape.Cylinder;
/**
* Created by konstantin.petrukhnov@gmail.com on 2017-01-04.
*/
public class Main extends SimpleApplication {
private Main() {
}
public static void main(String[] args) {
final Main app = new Main();
app.setPauseOnLostFocus(false);
app.showSettings = false;
app.start();
}
@Override
public void simpleInitApp() {
Box b = new Box(1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Blue);
geom.setMaterial(mat);
rootNode.attachChild(geom);
Cylinder cyl = new Cylinder(100, 100, 1, 100, true);
Geometry geom2 = new Geometry("Cyl", cyl);
Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat2.setColor("Color", ColorRGBA.Green);
geom2.setMaterial(mat2);
rootNode.attachChild(geom2);
}
@Override
public void simpleUpdate(float tpf) {
//TODO: add update code
}
@Override
public void simpleRender(RenderManager rm) {
//TODO: add render code
}
}
@birgersp
Copy link

Do you really need all of these dependencies for this simple example application? How many of them can you remove?

@pavly-gerges
Copy link

Do you really need all of these dependencies for this simple example application? How many of them can you remove?
Testcases for jmonkeyEngine for amd64 , amd32 & arm32 devices

https://github.com/Scrappers-glitch/JmeCarPhysicsTestRPI

just for anyone searches this topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment