Skip to content

Commit

Permalink
how about that?
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-j committed Feb 20, 2016
1 parent 9bc88b0 commit 90a3f17
Show file tree
Hide file tree
Showing 21 changed files with 117 additions and 104 deletions.
49 changes: 30 additions & 19 deletions bte-test/build.gradle
Original file line number Diff line number Diff line change
@@ -1,35 +1,46 @@
apply plugin: "java"

sourceCompatibility = JavaVersion.VERSION_1_7
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

sourceCompatibility = 1.7
sourceSets.main.java.srcDirs = [ "src/" ]


project.ext.mainClassName = "io.piotrjastrzebski.btetest.AIEditorTestProject"
project.ext.assetsDir = new File("../bte/assets");
project.ext.mainClassName = "io.piotrjastrzebski.bte.desktop.AIEditorTestProject"
//project.ext.assetsDir = new File("../bte/assets");

task run(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
// 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
//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 + "-test"
linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/bte/assets'
}
}

dist.dependsOn classes

eclipse.project {
name = appName + "-test"
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)
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package io.piotrjastrzebski.btetest;
package io.piotrjastrzebski.bte.desktop;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ai.btree.BehaviorTree;
import com.badlogic.gdx.ai.btree.Task;
import com.badlogic.gdx.ai.btree.branch.*;
import com.badlogic.gdx.ai.btree.decorator.*;
import com.badlogic.gdx.ai.btree.decorator.AlwaysFail;
import com.badlogic.gdx.ai.btree.decorator.AlwaysSucceed;
import com.badlogic.gdx.ai.btree.decorator.Include;
import com.badlogic.gdx.ai.btree.leaf.Failure;
import com.badlogic.gdx.ai.btree.leaf.Success;
import com.badlogic.gdx.ai.btree.utils.BehaviorTreeLibrary;
Expand All @@ -27,7 +29,7 @@
import com.kotcrab.vis.ui.widget.VisTextButton;
import io.piotrjastrzebski.bte.AIEditor;
import io.piotrjastrzebski.bte.EditorBehaviourTreeLibrary;
import io.piotrjastrzebski.btetest.dog.*;
import io.piotrjastrzebski.bte.desktop.dog.*;

/**
* Created by EvilEntity on 04/02/2016.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
******************************************************************************/

package io.piotrjastrzebski.btetest.dog;
package io.piotrjastrzebski.bte.desktop.dog;

import com.badlogic.gdx.ai.btree.LeafTask;
import com.badlogic.gdx.ai.btree.Task;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
******************************************************************************/

package io.piotrjastrzebski.btetest.dog;
package io.piotrjastrzebski.bte.desktop.dog;

import com.badlogic.gdx.ai.btree.LeafTask;
import com.badlogic.gdx.ai.btree.Task;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
******************************************************************************/

package io.piotrjastrzebski.btetest.dog;
package io.piotrjastrzebski.bte.desktop.dog;

import com.badlogic.gdx.ai.GdxAI;
import com.badlogic.gdx.ai.btree.BehaviorTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
******************************************************************************/

package io.piotrjastrzebski.btetest.dog;
package io.piotrjastrzebski.bte.desktop.dog;

import com.badlogic.gdx.ai.btree.LeafTask;
import com.badlogic.gdx.ai.btree.Task;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
******************************************************************************/

package io.piotrjastrzebski.btetest.dog;
package io.piotrjastrzebski.bte.desktop.dog;

import com.badlogic.gdx.ai.btree.LeafTask;
import com.badlogic.gdx.ai.btree.Task;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
******************************************************************************/

package io.piotrjastrzebski.btetest.dog;
package io.piotrjastrzebski.bte.desktop.dog;

import com.badlogic.gdx.ai.btree.LeafTask;
import com.badlogic.gdx.ai.btree.Task;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
******************************************************************************/

package io.piotrjastrzebski.btetest.dog;
package io.piotrjastrzebski.bte.desktop.dog;

import com.badlogic.gdx.ai.btree.LeafTask;
import com.badlogic.gdx.ai.btree.Task;
Expand Down
77 changes: 37 additions & 40 deletions bte-window/build.gradle
Original file line number Diff line number Diff line change
@@ -1,49 +1,46 @@
apply plugin: "java"

sourceCompatibility = JavaVersion.VERSION_1_7
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

sourceCompatibility = 1.7
sourceSets.main.java.srcDirs = [ "src/" ]

project.ext.mainClassName = "io.piotrjastrzebski.btewindow.AIEditorWindow"
project.ext.assetsDir = new File("../bte/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);
//project.ext.mainClassName = "io.piotrjastrzebski.bte.window.AIEditorWindow"
//project.ext.assetsDir = new File("../bte/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

manifest {
attributes 'Main-Class': project.mainClassName
eclipse {
project {
name = appName + "-window"
linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/bte/assets'
}
}

dist.dependsOn classes

eclipse.project {
name = appName + "-test"
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

//task javadocJar(type: Jar, dependsOn: javadoc) {
// classifier = 'javadoc'
// from javadoc.destinationDir
//}

artifacts {
archives sourcesJar
// archives javadocJar
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: 'asseyouts' ]);
def writer = new FileWriter(file(".classpath"))
def printer = new XmlNodePrinter(new PrintWriter(writer))
printer.setPreserveWhitespace(true)
printer.print(classpath)
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.piotrjastrzebski.btewindow;
package io.piotrjastrzebski.bte.window;

import com.badlogic.gdx.Application;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
Expand Down Expand Up @@ -144,8 +145,7 @@ public interface WindowListener {
*/
void onClose();
}

public static void main (String[] args) {
System.out.println("Dummy main, go away!");
System.out.println("Hi");
}
}
4 changes: 2 additions & 2 deletions bte/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: "java"

sourceCompatibility = JavaVersion.VERSION_1_7
sourceCompatibility = 1.7
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

sourceSets.main.java.srcDirs = [ "src/" ]


eclipse.project {
name = appName + "-lib"
name = appName + "-core"
}

task sourcesJar(type: Jar, dependsOn: classes) {
Expand Down
3 changes: 1 addition & 2 deletions bte/src/io/piotrjastrzebski/bte/AIEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.kotcrab.vis.ui.VisUI;
import com.kotcrab.vis.ui.widget.VisWindow;

import io.piotrjastrzebski.bte.model.BehaviorTreeModel;
import io.piotrjastrzebski.bte.model.tasks.Guard;
import io.piotrjastrzebski.bte.view.BehaviorTreeView;
Expand Down Expand Up @@ -265,7 +264,7 @@ public interface BehaviorTreeStepStrategy {
}

public interface EditorWindowClosedListener {
boolean onClose();
boolean onClose ();
}

public void setClosedListener (EditorWindowClosedListener closedListener) {
Expand Down
5 changes: 4 additions & 1 deletion bte/src/io/piotrjastrzebski/bte/model/BehaviorTreeModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
import com.badlogic.gdx.utils.ObjectIntMap;
import io.piotrjastrzebski.bte.BehaviorTreeWriter;
import io.piotrjastrzebski.bte.EditorBehaviourTreeLibrary;
import io.piotrjastrzebski.bte.model.edit.*;
import io.piotrjastrzebski.bte.model.edit.AddCommand;
import io.piotrjastrzebski.bte.model.edit.CommandManager;
import io.piotrjastrzebski.bte.model.edit.MoveCommand;
import io.piotrjastrzebski.bte.model.edit.RemoveCommand;
import io.piotrjastrzebski.bte.model.tasks.FakeRootModel;
import io.piotrjastrzebski.bte.model.tasks.ReflectionUtils;
import io.piotrjastrzebski.bte.model.tasks.TaskModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public void init (TaskModel root, BehaviorTreeModel model) {
children.clear();
children.add(root);
// need some wrapped task so remove command works
@SuppressWarnings("rawtypes")
Selector selector = new Selector();
@SuppressWarnings("rawtypes") Selector selector = new Selector();
selector.addChild(root.wrapped);
wrapped = selector;
root.setParent(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ public static boolean remove(Task what, Task from) {
if (from instanceof BranchTask) {
Field field = ClassReflection.getDeclaredField(BranchTask.class, "children");
field.setAccessible(true);
@SuppressWarnings("unchecked")
Array<Task> children = (Array<Task>)field.get(from);
@SuppressWarnings("unchecked") Array<Task> children = (Array<Task>)field.get(from);
if (children.removeValue(what, true)) {
// note in this class there are some more children that we need to deal with
if (from instanceof SingleRunningChildBranch) {
Expand Down
3 changes: 1 addition & 2 deletions bte/src/io/piotrjastrzebski/bte/model/tasks/TaskModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.badlogic.gdx.utils.Pool;
import com.badlogic.gdx.utils.reflect.ClassReflection;
import com.badlogic.gdx.utils.reflect.ReflectionException;

import io.piotrjastrzebski.bte.model.BehaviorTreeModel;
import io.piotrjastrzebski.bte.model.tasks.fields.EditableFields;
import io.piotrjastrzebski.bte.model.tasks.fields.EditableFields.EditableField;
Expand Down Expand Up @@ -361,6 +360,6 @@ public void wrappedUpdated (Task.Status from, Task.Status to) {
}

public interface ChangeListener {
void statusChanged(Task.Status from, Task.Status to);
void statusChanged (Task.Status from, Task.Status to);
}
}
15 changes: 11 additions & 4 deletions bte/src/io/piotrjastrzebski/bte/view/BehaviorTreeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@
import com.badlogic.gdx.ai.btree.Task;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.scenes.scene2d.*;
import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.utils.*;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.Tree;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop;
import com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectMap;
import com.kotcrab.vis.ui.VisUI;
import com.kotcrab.vis.ui.widget.*;

import com.kotcrab.vis.ui.widget.file.FileChooser;
import com.kotcrab.vis.ui.widget.file.FileChooserAdapter;
import io.piotrjastrzebski.bte.AIEditor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.utils.reflect.ClassReflection;
import com.badlogic.gdx.utils.reflect.Constructor;
Expand Down
Loading

0 comments on commit 90a3f17

Please sign in to comment.