use of com.artemis.Entity in project commons-gdx by gemserk.
the class EntityStore method refreshPool.
public int refreshPool() {
int size = freedThisFrame.size;
if (size <= 0)
return 0;
Entity[] entities = freedThisFrame.items;
for (int i = 0; i < size; i++) {
Entity entity = entities[i];
super.free(entity);
}
freedThisFrame.clear();
return size;
}
use of com.artemis.Entity in project commons-gdx by gemserk.
the class GetComponentPerformanceTest method testTimeWithGetComponentFromClass.
public long testTimeWithGetComponentFromClass(int iterations) {
World world = new World();
Entity e = world.createEntity();
e.addComponent(new MyTestComponent());
e.refresh();
long startNanoTime = System.nanoTime();
for (int i = 0; i < iterations; i++) {
// MyTestComponent myTestComponent = e.getComponent(MyTestComponent.class);
e.getComponent(MyTestComponent.class);
}
return System.nanoTime() - startNanoTime;
}
use of com.artemis.Entity in project commons-gdx by gemserk.
the class GetComponentPerformanceTest method testTimeWithGetComponentFromMapper.
public long testTimeWithGetComponentFromMapper(int iterations) {
World world = new World();
Entity e = world.createEntity();
e.addComponent(new MyTestComponent());
e.refresh();
ComponentMapper<MyTestComponent> myTestComponentMapper = new ComponentMapper<MyTestComponent>(MyTestComponent.class, world.getEntityManager());
long startNanoTime = System.nanoTime();
for (int i = 0; i < iterations; i++) {
myTestComponentMapper.get(e);
// MyTestComponent myTestComponent = myTestComponentMapper.get(e);
}
return System.nanoTime() - startNanoTime;
}
use of com.artemis.Entity in project commons-gdx by gemserk.
the class GetComponentPerformanceTest method testTimeWithGetComponentUsingTypeAndCacheClass.
public long testTimeWithGetComponentUsingTypeAndCacheClass(int iterations) {
World world = new World();
Entity e = world.createEntity();
e.addComponent(new MyTestComponent());
e.refresh();
ComponentType myTestComponentType = ComponentTypeManager.getTypeFor(MyTestComponent.class);
Class<MyTestComponent> myTestComponentClass = MyTestComponent.class;
long startNanoTime = System.nanoTime();
for (int i = 0; i < iterations; i++) {
// MyTestComponent myTestComponent = myTestComponentClass.cast(e.getComponent(myTestComponentType.getId()));
myTestComponentClass.cast(e.getComponent(myTestComponentType.getId()));
}
return System.nanoTime() - startNanoTime;
}
use of com.artemis.Entity in project commons-gdx by gemserk.
the class GetComponentPerformanceTest method testTimeWithGetComponentFromClassWithClassCache.
public long testTimeWithGetComponentFromClassWithClassCache(int iterations) {
World world = new World();
Entity e = world.createEntity();
e.addComponent(new MyTestComponent());
e.refresh();
Class<MyTestComponent> myTestComponentClass = MyTestComponent.class;
long startNanoTime = System.nanoTime();
for (int i = 0; i < iterations; i++) {
// MyTestComponent myTestComponent = e.getComponent(myTestComponentClass);
e.getComponent(myTestComponentClass);
}
return System.nanoTime() - startNanoTime;
}
Aggregations