commit 7c99c1075ee6ebb38e9a1f53fcce586f2c112294 Author: Enrico Fasoli Date: Sun Jun 28 01:27:17 2015 +0200 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..47454ee --- /dev/null +++ b/.gitignore @@ -0,0 +1,64 @@ +## Java + +*.class +*.war +*.ear +hs_err_pid* + +## GWT +war/ +html/war/gwt_bree/ +html/gwt-unitCache/ +.apt_generated/ +html/war/WEB-INF/deploy/ +html/war/WEB-INF/classes/ +.gwt/ +gwt-unitCache/ +www-test/ +.gwt-tmp/ + +## Android Studio and Intellij and Android in general +android/libs/armeabi/ +android/libs/armeabi-v7a/ +android/libs/x86/ +android/gen/ +.idea/ +*.ipr +*.iws +*.iml +out/ +com_crashlytics_export_strings.xml + +## Eclipse +.classpath +.project +.metadata +**/bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.externalToolBuilders/ +*.launch + +## NetBeans +**/nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +nbactions.xml +nb-configuration.xml + +## Gradle + +.gradle +gradle-app.setting +build/ + +## OS Specific +.DS_Store diff --git a/.nb-gradle-properties b/.nb-gradle-properties new file mode 100644 index 0000000..761ade2 --- /dev/null +++ b/.nb-gradle-properties @@ -0,0 +1,4 @@ + + + + diff --git a/.nb-gradle/private/cache/AIrium-d41d8cd98f00b204e9800998ecf8427e b/.nb-gradle/private/cache/AIrium-d41d8cd98f00b204e9800998ecf8427e new file mode 100644 index 0000000..84bc020 Binary files /dev/null and b/.nb-gradle/private/cache/AIrium-d41d8cd98f00b204e9800998ecf8427e differ diff --git a/.nb-gradle/private/cache/core-ae20cee98ae962b39919c99c9fa7e1c8 b/.nb-gradle/private/cache/core-ae20cee98ae962b39919c99c9fa7e1c8 new file mode 100644 index 0000000..a0e82cf Binary files /dev/null and b/.nb-gradle/private/cache/core-ae20cee98ae962b39919c99c9fa7e1c8 differ diff --git a/.nb-gradle/private/cache/desktop-e1fc414efb00462ad25041a21e45e696 b/.nb-gradle/private/cache/desktop-e1fc414efb00462ad25041a21e45e696 new file mode 100644 index 0000000..a873397 Binary files /dev/null and b/.nb-gradle/private/cache/desktop-e1fc414efb00462ad25041a21e45e696 differ diff --git a/.nb-gradle/profiles/private/aux-config b/.nb-gradle/profiles/private/aux-config new file mode 100644 index 0000000..af2bccb --- /dev/null +++ b/.nb-gradle/profiles/private/aux-config @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..fbdd40c --- /dev/null +++ b/build.gradle @@ -0,0 +1,55 @@ +buildscript { + repositories { + mavenCentral() + maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } + } + dependencies { + } +} + +allprojects { + apply plugin: "eclipse" + apply plugin: "idea" + + version = '1.0' + ext { + appName = 'ai' + gdxVersion = '1.6.3' + roboVMVersion = '1.4.0' + box2DLightsVersion = '1.3' + ashleyVersion = '1.4.0' + aiVersion = '1.5.0' + } + + repositories { + mavenCentral() + maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } + maven { url "https://oss.sonatype.org/content/repositories/releases/" } + } +} + +project(":desktop") { + apply plugin: "java" + + + dependencies { + compile project(":core") + compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" + } +} + +project(":core") { + apply plugin: "java" + + + dependencies { + compile "com.badlogicgames.gdx:gdx:$gdxVersion" + compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" + } +} + +tasks.eclipse.doLast { + delete ".project" +} \ No newline at end of file diff --git a/core/assets/badlogic.jpg b/core/assets/badlogic.jpg new file mode 100644 index 0000000..4390da6 Binary files /dev/null and b/core/assets/badlogic.jpg differ diff --git a/core/build.gradle b/core/build.gradle new file mode 100644 index 0000000..03cd1be --- /dev/null +++ b/core/build.gradle @@ -0,0 +1,11 @@ +apply plugin: "java" + +sourceCompatibility = 1.6 +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' + +sourceSets.main.java.srcDirs = [ "src/" ] + + +eclipse.project { + name = appName + "-core" +} diff --git a/core/src/com/mygdx/game/Game.java b/core/src/com/mygdx/game/Game.java new file mode 100644 index 0000000..0df57f7 --- /dev/null +++ b/core/src/com/mygdx/game/Game.java @@ -0,0 +1,59 @@ +package com.mygdx.game; + +import com.badlogic.gdx.ApplicationAdapter; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; +import logic.Element; +import logic.World; + +public class Game extends ApplicationAdapter { + + private static Game game; + SpriteBatch batch; + ShapeRenderer shaper; + Texture img; + private World world; + + @Override + public void create() { + game = this; + batch = new SpriteBatch(); + img = new Texture("badlogic.jpg"); + world = new World(640, 480); + shaper = new ShapeRenderer(); + //shaper.setAutoShapeType(true); + } + + @Override + public void render() { + // Input + if(Gdx.input.isKeyJustPressed(Input.Keys.SPACE)){ + world.getElements().clear(); + } + // Update + world.update(); + // Draw + Gdx.gl.glClearColor(0, 0, 0, 1); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + /*batch.begin(); + batch.draw(img, 0, 0); + batch.end();*/ + shaper.setColor(1, 1, 1, 1); + shaper.begin(ShapeRenderer.ShapeType.Line); + //shaper.circle(640, 480, 100); + for(Element e: world.getElements()) e.render(shaper); + shaper.end(); + } + + public World getWorld() { + return world; + } + + public static Game get() { + return game; + } +} diff --git a/core/src/logic/Creature.java b/core/src/logic/Creature.java new file mode 100644 index 0000000..a0a5786 --- /dev/null +++ b/core/src/logic/Creature.java @@ -0,0 +1,132 @@ +package logic; + +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; +import com.mygdx.game.Game; + +/** + * A (hopefully) smart biological creature. + * + * @author fazo + */ +public class Creature extends Element { + + public static final int default_radius = 20; + + private float dir, speed, accel, sightRange, fov, fitness, rotSpeed; + private float hp; + private Sight sight; + + public Creature(float x, float y) { + super(x, y, default_radius); + dir = (float) (Math.random() * 2 * Math.PI); + hp = 100; + speed = (float) Math.random() * 3; + rotSpeed = (float) Math.random() - 0.5f; + accel = 0f; + sightRange = 40; + fov = (float) Math.PI / 2; + fitness = 100; + } + + @Override + public void update() { + // apply hunger + hp -= 0.1f; + if (hp < 0) { + Game.get().getWorld().getGraveyard().add(this); + } + speed += accel; // apply acceleration + if (speed > 0) { + speed -= 0.001; // attrito + } + if (speed < 0) { + speed = 0; + } + // apply speed + float xMul = (float) Math.cos(dir), yMul = (float) Math.sin(dir); + move(xMul * speed, yMul * speed); + dir += rotSpeed; + // try eating + eat(); + fitness -= 0.1; + if (dir > 2 * Math.PI) { + dir -= 2 * Math.PI; + } + sight = look(); + } + + @Override + public void render(ShapeRenderer s) { + // Body + s.setColor(1 - (hp / 100), hp / 100, 0, 1); + s.circle(getX(), getY(), getSize()); + // Eye + double relX = Math.cos(dir) * getSize(), relY = Math.sin(dir) * getSize(); + if (sight != null) { + float c = sight.getDistance() / sightRange; + if (sight.getElement() instanceof Creature) { + s.setColor(c, 0, 0, 1); + } else if (sight.getElement() instanceof Vegetable) { + s.setColor(0, c, 0, 1); + } else { + s.setColor(1, 1, 1, 1); + } + } + s.circle((float) relX + getX(), (float) relY + getY(), 3); + //FOV + float degrees = fov * 180f / (float) Math.PI; + float orient = dir * 180f / (float) Math.PI - degrees / 2; + s.setColor(0.3f, 0.3f, 0.3f, 1); + s.arc((float) relX + getX(), (float) relY + getY(), sightRange, orient, degrees); + } + + public Sight look() { + Element seen = null; + float dist = 0, angle = 0, ndir = dir - (float) Math.PI; + for (Element e : Game.get().getWorld().getElements()) { + if (e == this) { + continue; + } + float tempDist = distanceFrom(e); + if (tempDist > sightRange) { + continue; + } + //System.out.println("TempDist "+tempDist+" SightRange "+sightRange); + if (tempDist > dist && seen != null) { + continue; + } + float relAngle = (float) (Math.atan2(getY() - e.getY(), getX() - e.getX())); + //if((relAngle > dir-fov/2 && relAngle < dir+fov/2)){ + if (Math.abs(relAngle - ndir) < fov) { + // Visible + seen = e; + angle = relAngle - ndir; + dist = tempDist; + } + //System.out.println("RelAngle "+relAngle+" Dir "+ndir); + } + if (seen != null) { + return new Sight(seen, dist, angle); + } else { + return null; + } + } + + public void eat() { + for (Element e : Game.get().getWorld().getElements()) { + if (e instanceof Vegetable && overlaps(e)) { + e.setSize(e.getSize() - 0.1f); + hp += 0.1f; + fitness++; + if (hp > 100) { + hp = 100; + } + } + } + } + + public void setDirection(float dir) { + this.dir = dir; + } + +} diff --git a/core/src/logic/Element.java b/core/src/logic/Element.java new file mode 100644 index 0000000..93d458a --- /dev/null +++ b/core/src/logic/Element.java @@ -0,0 +1,73 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package logic; + +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; + +/** + * + * @author fazo + */ +public abstract class Element { + + private float x, y, size; + + public Element(float x, float y, float size) { + this.x = x; + this.y = y; + this.size = size; + } + + public float distanceFrom(Element e) { + return (float) Math.sqrt(Math.pow(e.x - x, 2) + Math.pow(e.y - y, 2)) - getSize() - e.getSize(); + } + + public boolean overlaps(Element e) { + return distanceFrom(e) < 0; + } + + public boolean overlaps(float x, float y, float radius) { + return (float) Math.sqrt(Math.pow(x - this.x, 2) + Math.pow(y - this.y, 2)) < getSize() + radius; + } + + public boolean overlaps(float x, float y) { + return overlaps(x, y, 1); + } + + public void move(float deltaX, float deltaY) { + x += deltaX; + y += deltaY; + } + + public abstract void update(); + + public abstract void render(ShapeRenderer s); + + public float getX() { + return x; + } + + public float getY() { + return y; + } + + public float getSize() { + return size; + } + + public void setX(float x) { + this.x = x; + } + + public void setY(float y) { + this.y = y; + } + + public void setSize(float size) { + this.size = size; + } + +} diff --git a/core/src/logic/Sight.java b/core/src/logic/Sight.java new file mode 100644 index 0000000..e2f8d43 --- /dev/null +++ b/core/src/logic/Sight.java @@ -0,0 +1,34 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package logic; + +/** + * + * @author fazo + */ +public class Sight { + private Element seen; + private float distance, angle; + + public Sight(Element seen, float distance, float angle) { + this.seen = seen; + this.distance = distance; + this.angle = angle; + } + + public Element getElement() { + return seen; + } + + public float getDistance() { + return distance; + } + + public float getAngle() { + return angle; + } + +} diff --git a/core/src/logic/Vegetable.java b/core/src/logic/Vegetable.java new file mode 100644 index 0000000..a88cde7 --- /dev/null +++ b/core/src/logic/Vegetable.java @@ -0,0 +1,33 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package logic; + +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; + +/** + * + * @author fazo + */ +public class Vegetable extends Element { + + public static final int default_radius = 5; + private float x, y; + + public Vegetable(float x, float y) { + super(x, y, default_radius); + } + + @Override + public void update() { + + } + + @Override + public void render(ShapeRenderer s) { + s.setColor(1, 1, 1, 1); + s.circle(getX(), getY(), getSize()); + } +} diff --git a/core/src/logic/World.java b/core/src/logic/World.java new file mode 100644 index 0000000..b5f523e --- /dev/null +++ b/core/src/logic/World.java @@ -0,0 +1,94 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package logic; + +import java.util.ArrayList; + +/** + * + * @author fazo + */ +public class World { + + private int width, height; + public ArrayList elements; + public ArrayList graveyard; + + public World(int width, int height) { + this.width = width; + this.height = height; + elements = new ArrayList(); + graveyard = new ArrayList(); + } + + public void update() { + while (elements.size() < 20) { + if (Math.random() < 0.2) { + spawnCreature(); + } else { + spawnVegetable(); + } + /*Creature c = new Creature(300,400); + elements.add(c); + elements.add(new Vegetable(300,450));*/ + } + elements.removeAll(graveyard); + graveyard.clear(); + for(Element e: elements) e.update(); + } + + private void spawn(boolean isCreature) { + int x, y, r; + boolean overlaps = false; + if (isCreature) { + r = Creature.default_radius; + } else { + r = Vegetable.default_radius; + } + do { + overlaps = false; + x = (int) (Math.random() * width); + y = (int) (Math.random() * height); + for (Element e : elements) { + if (e.overlaps(x, y, r)) { + overlaps = true; + } + } + } while (overlaps); + if (isCreature) { + System.out.println("New Creat: " + x + " " + y); + elements.add(new Creature(x, y)); + } else { + System.out.println("New Veg: " + x + " " + y); + elements.add(new Vegetable(x, y)); + } + } + + private void spawnVegetable() { + spawn(false); + } + + private void spawnCreature() { + spawn(true); + } + + public int getWidth() { + return width; + } + + public int getHeight() { + return height; + } + + public ArrayList getElements() { + return elements; + } + + public ArrayList getGraveyard() { + return graveyard; + } + +} diff --git a/core/src/logic/neural/Brain.java b/core/src/logic/neural/Brain.java new file mode 100644 index 0000000..c6ae108 --- /dev/null +++ b/core/src/logic/neural/Brain.java @@ -0,0 +1,9 @@ +package logic.neural; + +/** + * + * @author fazo + */ +public class Brain { + +} diff --git a/core/src/logic/neural/Connection.java b/core/src/logic/neural/Connection.java new file mode 100644 index 0000000..cfc7b12 --- /dev/null +++ b/core/src/logic/neural/Connection.java @@ -0,0 +1,22 @@ +package logic.neural; + +/** + * + * @author fazo + */ +public class Connection { + private float weight; + + public Connection(float weight) { + this.weight = weight; + } + + public float getWeight() { + return weight; + } + + public void setWeight(float weight) { + this.weight = weight; + } + +} diff --git a/core/src/logic/neural/Neuron.java b/core/src/logic/neural/Neuron.java new file mode 100644 index 0000000..68e16c6 --- /dev/null +++ b/core/src/logic/neural/Neuron.java @@ -0,0 +1,16 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package logic.neural; + +import java.util.ArrayList; + +/** + * + * @author fazo + */ +public class Neuron { + private ArrayList inputs, outputs; +} diff --git a/desktop/build.gradle b/desktop/build.gradle new file mode 100644 index 0000000..d11233f --- /dev/null +++ b/desktop/build.gradle @@ -0,0 +1,46 @@ +apply plugin: "java" + +sourceCompatibility = 1.6 +sourceSets.main.java.srcDirs = [ "src/" ] + +project.ext.mainClassName = "com.mygdx.game.desktop.DesktopLauncher" +project.ext.assetsDir = new File("../core/assets"); + +task run(dependsOn: classes, type: JavaExec) { + main = project.mainClassName + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + workingDir = project.assetsDir + ignoreExitValue = true +} + +task dist(type: Jar) { + from files(sourceSets.main.output.classesDir) + from files(sourceSets.main.output.resourcesDir) + from {configurations.compile.collect {zipTree(it)}} + from files(project.assetsDir); + + manifest { + attributes 'Main-Class': project.mainClassName + } +} + +dist.dependsOn classes + +eclipse { + project { + name = appName + "-desktop" + linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/core/assets' + } +} + +task afterEclipseImport(description: "Post processing after project generation", group: "IDE") { + doLast { + def classpath = new XmlParser().parse(file(".classpath")) + new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]); + def writer = new FileWriter(file(".classpath")) + def printer = new XmlNodePrinter(new PrintWriter(writer)) + printer.setPreserveWhitespace(true) + printer.print(classpath) + } +} \ No newline at end of file diff --git a/desktop/src/com/mygdx/game/desktop/DesktopLauncher.java b/desktop/src/com/mygdx/game/desktop/DesktopLauncher.java new file mode 100644 index 0000000..3504c01 --- /dev/null +++ b/desktop/src/com/mygdx/game/desktop/DesktopLauncher.java @@ -0,0 +1,12 @@ +package com.mygdx.game.desktop; + +import com.badlogic.gdx.backends.lwjgl.LwjglApplication; +import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; +import com.mygdx.game.Game; + +public class DesktopLauncher { + public static void main (String[] arg) { + LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); + new LwjglApplication(new Game(), config); + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..fa55fd1 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.daemon=true +org.gradle.jvmargs=-Xms128m -Xmx512m +org.gradle.configureondemand=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..b979729 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..59b73af --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sat Sep 21 13:08:26 CEST 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=http\://services.gradle.org/distributions/gradle-2.4-all.zip diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..91a7e26 --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..74fc652 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include 'desktop', 'core' \ No newline at end of file