Skip to content

Instantly share code, notes, and snippets.

View DaanVanYperen's full-sized avatar

Daan van Yperen DaanVanYperen

View GitHub Profile
public class ExampleTest {
public static class PetOwner extends Component {
public PetOwner() {}
@LinkPolicy(LinkPolicy.Policy.CHECK_SOURCE_AND_TARGETS)
@EntityId public IntBag pets =new IntBag();
}
Entity junkdog;
Entity yak;
package net.mostlyoriginal.plugin;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* @author Daan van Yperen
*/
package com.artemis;
import java.util.HashMap;
/**
* @author Daan van Yperen
*/
public class DebugWorld extends World {
final DebugLogStrategy logStrategy;
final HashMap<Integer, DebugComponent> debugComponents;
@DaanVanYperen
DaanVanYperen / Tint.java
Last active August 30, 2015 21:53
odb cdi Pattern for Tweening
public class Tint extends Component implements Tweenable<Tint> {
@Override
public Tint tween(Tint a, Tint b, float value) {
final Interpolation linear = Interpolation.linear;
final Color colorA = a.color;
final Color colorB = b.color;
@DaanVanYperen
DaanVanYperen / AssetManager.java
Last active August 29, 2015 21:12
ECS - Asset manager pattern
/**
* Manages reference components to assets.
*
* - Adds asset reference component to entities with metadata component.
* - Reloads asset reference if removed.
* - Removes asset reference when metadata component is removed.
*
* @author Daan van Yperen
*
* @param <A> Identifying metadata component type.