Skip to content

Commit

Permalink
Fluid entity support.
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanVanYperen committed Sep 11, 2016
1 parent c7bc310 commit 11dc663
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 3 deletions.
10 changes: 9 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
appVersion = '1.5'

gdxVersion = '1.9.4'
artemisVersion = '2.0.0'
artemisVersion = '2.1.0-SNAPSHOT'
artemisContribVersion = '1.2.1'
roboVMVersion = '2.2.0'
//box2DLightsVersion = '1.4'
Expand All @@ -27,6 +27,9 @@ buildscript {
// lib for artemis-odb weaving.
// see https://github.com/junkdog/artemis-odb/wiki/Bytecode-weaving
classpath "net.onedaybeard.artemis:artemis-odb-gradle-plugin:$artemisVersion"

// lib for artemis-odb fluid.
classpath "net.onedaybeard.artemis:artemis-fluid-gradle-plugin:$artemisVersion"
}
}

Expand Down Expand Up @@ -160,6 +163,10 @@ project(":html") {
}
}

project(":components") {
apply plugin: "java"
}

project(":core") {
apply plugin: "java"

Expand All @@ -173,6 +180,7 @@ project(":core") {
}

dependencies {
compile project(":components")
compile "com.badlogicgames.gdx:gdx:$gdxVersion"

// Optional LibGDX Modules
Expand Down
8 changes: 8 additions & 0 deletions components/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apply plugin: "java"

sourceCompatibility = 1.7
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets.main.java.srcDirs = ["src/"]
eclipse.project {
name = appName + "-components"
}
21 changes: 20 additions & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
apply plugin: "java"
apply plugin: "artemis"
apply plugin: "artemis-fluid"

ext {
fluidOutputDir = file("$buildDir/generated-sources/fluid/")
}

sourceCompatibility = 1.7
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets.main.java.srcDirs = ["src/"]
sourceSets.main.java.srcDirs = ["src/",fluidOutputDir]
eclipse.project {
name = appName + "-core"
}
Expand All @@ -16,6 +21,20 @@ weave {
classesDir = sourceSets.main.output.classesDir
}

fluid {
generatedSourcesDirectory = fluidOutputDir;
classpath = sourceSets.main.compileClasspath
}
compileJava.dependsOn fluid

idea.module {
excludeDirs -= file("$buildDir")
excludeDirs += file("$buildDir/classes")
excludeDirs += file("$buildDir/dependency-cache")
excludeDirs += file("$buildDir/libs")
excludeDirs += file("$buildDir/tmp")
}

classes.finalizedBy weave

dependencies {
Expand Down
2 changes: 2 additions & 0 deletions core/src/net/mostlyoriginal/game/screen/GameScreen.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.mostlyoriginal.game.screen;

import com.artemis.SuperMapper;
import com.artemis.World;
import com.artemis.WorldConfigurationBuilder;
import com.badlogic.gdx.graphics.Color;
Expand Down Expand Up @@ -28,6 +29,7 @@ protected World createWorld() {
.dependsOn(OperationsPlugin.class)
.with(
// Replace with your own systems!
new SuperMapper(),
new CameraSystem(1),
new ClearScreenSystem(Color.valueOf(BACKGROUND_COLOR_HEX)),
new GameScreenAssetSystem(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.mostlyoriginal.game.screen.detection;

import com.artemis.SuperMapper;
import com.artemis.World;
import com.artemis.WorldConfigurationBuilder;
import com.artemis.managers.TagManager;
Expand Down Expand Up @@ -31,6 +32,7 @@ protected World createWorld() {
.dependsOn(OperationsPlugin.class)
.with(WorldConfigurationBuilder.Priority.HIGH,
// supportive
new SuperMapper(),
new TagManager(),
new CameraSystem(1),
new FeatureScreenAssetSystem(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import net.mostlyoriginal.api.system.core.PassiveSystem;
import net.mostlyoriginal.game.util.Anims;

import static com.artemis.E.E;

/**
* @author Daan van Yperen
*/
Expand All @@ -16,6 +18,11 @@ public class GameScreenSetupSystem extends PassiveSystem {
@Override
protected void initialize() {

E(world.create())
.pos()
.anim()
.renderable();

Anims.createCenteredAt(world,
GameScreenAssetSystem.DANCING_MAN_WIDTH,
GameScreenAssetSystem.DANCING_MAN_HEIGHT,
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include 'desktop', 'android', 'ios', 'html', 'matrix', 'core'
include 'desktop', 'android', 'ios', 'html', 'matrix', 'core','components'

0 comments on commit 11dc663

Please sign in to comment.