Skip to content

Commit 6c9f7cc

Browse files
Merge pull request #111 from DaanVanYperen/develop
Ludum dare release
2 parents f9e2b8f + 2ec4256 commit 6c9f7cc

File tree

96 files changed

+1346
-537
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+1346
-537
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ with all fancy features, check out these instead:
1818
- [playn-artemis-quickstart](https://github.com/DaanVanYperen/playn-artemis-quickstart)
1919

2020
### Library Versions
21-
Artemis-odb 2.0.x, (Optional) LibGDX 1.9+, tested with 1.9.4.
21+
Artemis-odb 2.1.x, (Optional) LibGDX 1.9.0-1.9.4, tested with 1.9.4.
2222

2323
### License
2424
The primary license for this code is MIT.
@@ -32,21 +32,21 @@ Some stubs from LibGDX are licensed under Apache 2.0.
3232
<dependency>
3333
<groupId>net.mostlyoriginal.artemis-odb</groupId>
3434
<artifactId>contrib-core</artifactId>
35-
<version>1.2.1</version>
35+
<version>2.1</version>
3636
</dependency>
3737

3838
<dependency>
3939
<groupId>net.mostlyoriginal.artemis-odb</groupId>
4040
<artifactId>contrib-eventbus</artifactId>
41-
<version>1.2.1</version>
41+
<version>2.1</version>
4242
</dependency>
4343
```
4444

4545
#### Gradle
4646

4747
```groovy
4848
dependencies {
49-
compile "net.mostlyoriginal.artemis-odb:contrib-core:1.2.1"
50-
compile "net.mostlyoriginal.artemis-odb:contrib-eventbus:1.2.1"
49+
compile "net.mostlyoriginal.artemis-odb:contrib-core:2.1"
50+
compile "net.mostlyoriginal.artemis-odb:contrib-eventbus:2.1"
5151
}
5252
```

contrib-benchmark/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>net.mostlyoriginal.artemis-odb</groupId>
77
<artifactId>contrib-parent</artifactId>
8-
<version>1.2.1</version>
8+
<version>2.1.0</version>
99
</parent>
1010
<artifactId>contrib-benchmark</artifactId>
1111
<packaging>jar</packaging>

contrib-core/pom.xml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>net.mostlyoriginal.artemis-odb</groupId>
77
<artifactId>contrib-parent</artifactId>
8-
<version>1.2.1</version>
8+
<version>2.1.0</version>
99
</parent>
1010
<artifactId>contrib-core</artifactId>
1111
<packaging>jar</packaging>
@@ -27,6 +27,25 @@
2727
<artifactId>mockito-all</artifactId>
2828
<scope>test</scope>
2929
</dependency>
30+
<dependency>
31+
<groupId>com.badlogicgames.gdx</groupId>
32+
<artifactId>gdx</artifactId>
33+
<scope>test</scope>
34+
<version>${libgdx.version}</version>
35+
</dependency>
36+
<dependency>
37+
<groupId>com.badlogicgames.gdx</groupId>
38+
<artifactId>gdx-backend-lwjgl</artifactId>
39+
<scope>test</scope>
40+
<version>${libgdx.version}</version>
41+
</dependency>
42+
<dependency>
43+
<groupId>com.badlogicgames.gdx</groupId>
44+
<artifactId>gdx-platform</artifactId>
45+
<classifier>natives-desktop</classifier>
46+
<scope>test</scope>
47+
<version>${libgdx.version}</version>
48+
</dependency>
3049
</dependencies>
3150

3251
<build>
@@ -47,4 +66,4 @@
4766
</plugins>
4867
</build>
4968

50-
</project>
69+
</project>

contrib-core/src/main/java/net/mostlyoriginal/api/component/common/ExtendedComponent.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.mostlyoriginal.api.component.common;
22

33
import com.artemis.PooledComponent;
4+
import com.artemis.annotations.Fluid;
45

56
import java.io.Serializable;
67

@@ -13,6 +14,7 @@
1314
*
1415
* @author Daan van Yperen
1516
*/
17+
@Fluid(swallowGettersWithParameters = true)
1618
public abstract class ExtendedComponent<T extends ExtendedComponent> extends PooledComponent
1719
implements Serializable, Mirrorable<T> {
1820
}

contrib-core/src/main/java/net/mostlyoriginal/api/component/common/Mirrorable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ public interface Mirrorable<T extends Component & Mirrorable> {
1414
* @param t component to mirror
1515
* @return {@code this}
1616
*/
17-
T set(T t);
17+
void set(T t);
1818
}

contrib-core/src/main/java/net/mostlyoriginal/api/component/common/Tweenable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ public interface Tweenable<T extends Component & Tweenable<T>> {
1717
* @param value tween (0..1)
1818
* @return {@code this}
1919
*/
20-
T tween(T a, T b, float value);
20+
void tween(T a, T b, float value);
2121
}

contrib-core/src/main/java/net/mostlyoriginal/api/plugin/extendedcomponentmapper/M.java

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public boolean isMirrorable() {
3838
* @return the instance of the component
3939
*/
4040
public A getSafe(int entityId, A fallback) {
41-
final A c = getSafe(entityId);
41+
final A c = get(entityId);
4242
return (c != null) ? c : fallback;
4343
}
4444

@@ -96,9 +96,11 @@ public A mirror(int targetId, int sourceId) {
9696
throw new RuntimeException("Component does not extend ExtendedComponent<T> or just Mirrorable<T>, required for #set.");
9797
}
9898

99-
final A source = getSafe(sourceId);
99+
final A source = get(sourceId);
100100
if ( source != null ) {
101-
return (A) ((Mirrorable)create(targetId)).set(source);
101+
Mirrorable mirrorable = (Mirrorable) create(targetId);
102+
mirrorable.set(source);
103+
return (A) mirrorable;
102104
} else {
103105
remove(targetId);
104106
return null;
@@ -169,17 +171,6 @@ public A get(Entity e) throws ArrayIndexOutOfBoundsException {
169171
return mapper.get(e);
170172
}
171173

172-
@Deprecated
173-
public A getSafe(Entity e, boolean forceNewInstance) {
174-
A component = mapper.get(e);
175-
176-
if(component == null && forceNewInstance) {
177-
component = mapper.create(e);
178-
}
179-
180-
return component;
181-
}
182-
183174
public A get(int entityId) throws ArrayIndexOutOfBoundsException {
184175
return mapper.get(entityId);
185176
}
@@ -196,21 +187,21 @@ public boolean has(Entity e) throws ArrayIndexOutOfBoundsException {
196187
return mapper.has(e);
197188
}
198189

199-
/**
200-
* @deprecated as of odb version 2.0.0 {@see #get} is as safe as getSafe.
201-
*/
202-
public A getSafe(Entity e) {
203-
return mapper.get(e);
204-
}
205-
206190
public boolean has(int entityId) {
207191
return mapper.has(entityId);
208192
}
209193

194+
/** Get instance of M for passed component type. moderately efficient. */
210195
public static <T extends Component> M<T> getFor(Class<T> type, World world) {
211196
return world.getSystem(ExtendedComponentMapperManager.class).getFor(type);
212197
}
213198

199+
/** Get instance of M for passed component. moderately efficient. */
200+
@SuppressWarnings("unchecked")
201+
public static <T extends Component> M<T> getFor(T component, World world) {
202+
return getFor((Class<T>)component.getClass(), world);
203+
}
204+
214205
public A get(Entity e, boolean forceNewInstance) throws ArrayIndexOutOfBoundsException {
215206
A component = mapper.get(e);
216207

contrib-core/src/main/java/net/mostlyoriginal/api/system/core/ReferenceManager.java

Lines changed: 0 additions & 90 deletions
This file was deleted.

contrib-core/src/main/java/net/mostlyoriginal/api/utils/reference/EntityReference.java

Lines changed: 0 additions & 15 deletions
This file was deleted.

contrib-core/src/test/java/net/mostlyoriginal/api/plugin/extendedcomponentmapper/ExtendedComponentMapperPluginTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,4 +306,28 @@ protected void process(Entity e) {
306306
createAndProcessWorld(new TestSystem());
307307
}
308308

309+
@Test
310+
public void Regression_When_superMapper_plugin_in_use_Should_not_break_regular_object_inection() {
311+
312+
class Injectable {}
313+
class TestSystem extends BaseSystem {
314+
315+
private M<TestMarker> mTest;
316+
@Wire Injectable injectable;
317+
318+
@Override
319+
protected void processSystem() {
320+
Assert.assertNotNull(injectable);
321+
}
322+
}
323+
324+
WorldConfiguration configuration = new WorldConfigurationBuilder()
325+
.dependsOn(ExtendedComponentMapperPlugin.class)
326+
.with(new TestSystem())
327+
.build();
328+
329+
configuration.register(new Injectable());
330+
331+
new World(configuration).process();
332+
}
309333
}

contrib-core/src/test/java/net/mostlyoriginal/api/plugin/extendedcomponentmapper/Pos.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ protected void reset() {
2424
}
2525

2626
@Override
27-
public Pos set(Pos pos) {
27+
public void set(Pos pos) {
2828
x = pos.x;
2929
y = pos.y;
30-
return this;
3130
}
3231
}

0 commit comments

Comments
 (0)