Package com.artemis

Examples of com.artemis.Entity.createComponent()


  public void empty_packed_shouldnt_reference_bytbuffer() throws Exception {
    World world = new World();
    world.initialize();
   
    Entity e1 = world.createEntity();
    EmptyPacked empty = e1.createComponent(EmptyPacked.class);
    assertEquals(PackedComponent.class, empty.getClass().getSuperclass());
  }
}
View Full Code Here


  @Test
  public void test_complex_fields_are_not_nulled() {
    Assert.assertEquals(PooledComponent.class, PooledObjectPosition.class.getSuperclass());
   
    Entity e = world.createEntity();
    PooledObjectPosition c = e.createComponent(PooledObjectPosition.class);
    assertEquals(0, c.vec2.x, 0.0001f);
    assertEquals(0, c.vec2.x, 0.0001f);
   
    c.vec2.x = 2;
    c.vec2.y = 3;
View Full Code Here

    world.process();
    e.deleteFromWorld();
    world.process();
   
    Entity e2 = world.createEntity();
    PooledObjectPosition c2 = e2.createComponent(PooledObjectPosition.class);
    assertEquals(2, c.vec2.x, 0.0001f);
    assertEquals(3, c.vec2.y, 0.0001f);
   
    assertTrue(c == c2);
  }
View Full Code Here

  public void pooled_class_transformation() throws Exception {
    World world = new World();
    world.initialize();
   
    Entity e = world.createEntity();
    PooledAllFields pooled = e.createComponent(PooledAllFields.class);
    assertEquals(PooledComponent.class, pooled.getClass().getSuperclass());
   
    Method reset = pooled.getClass().getMethod("reset");
    reset.setAccessible(true);
    reset.invoke(pooled);
View Full Code Here

   
    for (int i = 0; 2048 > i; i++)
      createEntity(world);
   
    Entity last = createEntity(world);
    last.createComponent(SimpleComponent.class).set(420);
   
    world.process();
   
    SimpleComponent component = last.getComponent(SimpleComponent.class);
    assertNotNull(component);
View Full Code Here

  public void pooled_class_with_many_constructors() throws Exception {
    World world = new World();
    world.initialize();
   
    Entity e1 = world.createEntity();
    PolyConstructor pooled1 = e1.createComponent(PolyConstructor.class);
    assertEquals(PooledComponent.class, pooled1.getClass().getSuperclass());

    PolyConstructor pooled2 = new PolyConstructor(420);
    assertEquals(PooledComponent.class, pooled2.getClass().getSuperclass());
  }
View Full Code Here

  }
 
  @Test @SuppressWarnings("unused")
  public void pooled_component_scanning() throws Exception {
    Entity e1 = world.createEntity();
    ComponentToWeave c1a = e1.createComponent(ComponentToWeave.class);
    PooledComponentWithReset c1b = e1.createComponent(PooledComponentWithReset.class);
    PooledComponentNotScanned c1c = e1.createComponent(PooledComponentNotScanned.class);
    e1.addToWorld();
   
    ClassMetadata scan1 = scan(ComponentToWeave.class);
View Full Code Here

 
  @Test @SuppressWarnings("unused")
  public void pooled_component_scanning() throws Exception {
    Entity e1 = world.createEntity();
    ComponentToWeave c1a = e1.createComponent(ComponentToWeave.class);
    PooledComponentWithReset c1b = e1.createComponent(PooledComponentWithReset.class);
    PooledComponentNotScanned c1c = e1.createComponent(PooledComponentNotScanned.class);
    e1.addToWorld();
   
    ClassMetadata scan1 = scan(ComponentToWeave.class);
    ClassMetadata scan2 = scan(PooledComponentWithReset.class);
View Full Code Here

  @Test @SuppressWarnings("unused")
  public void pooled_component_scanning() throws Exception {
    Entity e1 = world.createEntity();
    ComponentToWeave c1a = e1.createComponent(ComponentToWeave.class);
    PooledComponentWithReset c1b = e1.createComponent(PooledComponentWithReset.class);
    PooledComponentNotScanned c1c = e1.createComponent(PooledComponentNotScanned.class);
    e1.addToWorld();
   
    ClassMetadata scan1 = scan(ComponentToWeave.class);
    ClassMetadata scan2 = scan(PooledComponentWithReset.class);
    ClassMetadata scan3 = scan(PooledComponentNotScanned.class);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.