当前位置: 首页>>代码示例>>Java>>正文


Java World.process方法代码示例

本文整理汇总了Java中com.artemis.World.process方法的典型用法代码示例。如果您正苦于以下问题:Java World.process方法的具体用法?Java World.process怎么用?Java World.process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.artemis.World的用法示例。


在下文中一共展示了World.process方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Dispatch_TwoListeningSystem_BothCalled

import com.artemis.World; //导入方法依赖的package包/类
@Test
public void Dispatch_TwoListeningSystem_BothCalled() {
    WorldConfiguration config = new WorldConfiguration();
    final EventSystem eventManager = new EventSystem();
    config.setSystem(eventManager);
    ReceiveSystem s1 = new ReceiveSystem();
    config.setSystem(s1);
    ReceiveSystem2 s2 = new ReceiveSystem2();
    config.setSystem(s2);
    config.setSystem(new DispatchSystem());

    World w = new World(config);
    w.process();

    // no exception = success
    assertEquals(1, s1.count);
    assertEquals(1, s2.count);
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:19,代码来源:InterSystemEventTest.java

示例2: test_Dispatch_TwoListeningSystem_BothCalled

import com.artemis.World; //导入方法依赖的package包/类
public void test_Dispatch_TwoListeningSystem_BothCalled() {

        final WorldConfiguration config = new WorldConfiguration();
        final EventSystem eventManager = new EventSystem();
        config.setSystem(eventManager);
        ReceiveTestSystem s1 = new ReceiveTestSystem();
        config.setSystem(s1);
        ReceiveTestSystem2 s2 = new ReceiveTestSystem2();
        config.setSystem(s2);
        config.setSystem(new DispatchTestSystem());

        World w = new World(config);
        w.process();
        // no exception = success
        assertEquals(1, s1.count);
        assertEquals(1, s2.count);
    }
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:18,代码来源:InterSystemEventGwtTest.java

示例3: new_asset_should_setup_reference

import com.artemis.World; //导入方法依赖的package包/类
@Test
public void new_asset_should_setup_reference() {

	@Wire(injectInherited = true)
	class TestManager extends AssetManager<Sound, SoundReference> {

		public TestManager() {
			super(Sound.class, SoundReference.class);
		}

		@Override
		protected void setup(Entity entity, Sound sound, SoundReference soundReference) {
			Assert.assertNotNull(sound);
			Assert.assertNotNull(soundReference);
		}
	}

	World world = createWorld(new TestManager());
	world.createEntity().edit().create(Sound.class);
	world.process();
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:22,代码来源:AssetManagerTest.java

示例4: existing_asset_should_do_nothing

import com.artemis.World; //导入方法依赖的package包/类
@Test
public void existing_asset_should_do_nothing() {
	@Wire(injectInherited = true)
	class TestManager extends AssetManager<Sound, SoundReference> {
		int count=0;

		public TestManager() {
			super(Sound.class, SoundReference.class);
		}

		@Override
		protected void setup(Entity entity, Sound sound, SoundReference soundReference) {
			count++;
		}
	}

	TestManager manager = new TestManager();
	World world = createWorld(manager);
	world.createEntity().edit().create(Sound.class);
	world.process();
	world.process(); // second process should not cause changes.

	Assert.assertEquals(manager.count, 1);
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:25,代码来源:AssetManagerTest.java

示例5: DeferredSystem_EntityAdded_RegisteredWithPrincipal

import com.artemis.World; //导入方法依赖的package包/类
@Test
public void DeferredSystem_EntityAdded_RegisteredWithPrincipal() {

	EntityProcessPrincipal principal = mock(EntityProcessPrincipal.class);

	final WorldConfiguration config = new WorldConfiguration();
	config.setSystem(new TestDeferredSystem(Aspect.all(EmptyComponent.class), principal));
	// setup world and single entity.
	World w = new World(config);

	Entity myEntity = new EntityBuilder(w).with(EmptyComponent.class).build();
	w.process();

	// ensure it gets registered with the principal
	verify(principal, times(1)).registerAgent(eq(myEntity.getId()), any(EntityProcessAgent.class));
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:17,代码来源:DeferredEntityProcessingSystemTest.java

示例6: DeferredSystem_EntityRemoved_UnregisteredFromPrincipal

import com.artemis.World; //导入方法依赖的package包/类
@Test
public void DeferredSystem_EntityRemoved_UnregisteredFromPrincipal() {

	EntityProcessPrincipal principal = mock(EntityProcessPrincipal.class);

	// setup world and single entity.
	WorldConfiguration config = new WorldConfiguration();
	config.setSystem(new TestDeferredSystem(Aspect.all(EmptyComponent.class), principal));
	World w = new World(config);
	Entity myEntity = new EntityBuilder(w).with(EmptyComponent.class).build();
	w.process();
	w.deleteEntity(myEntity);
	w.process();

	// ensure it gets registered with the principal
	verify(principal, times(1)).unregisterAgent(eq(myEntity.getId()), any(EntityProcessAgent.class));
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:18,代码来源:DeferredEntityProcessingSystemTest.java

示例7: Should_not_step_over_entities_when_subscription_list_shrinks

import com.artemis.World; //导入方法依赖的package包/类
@Test
public void Should_not_step_over_entities_when_subscription_list_shrinks() {
	final World world = bakeWorld(new MySpreadProcessingSystem(10, 1));
	world.delta=0.5f;
	world.process();

	final int lastPokedIndex = getLastPokedIndex();

	// take out two entities that have been poked in this pass. This should shift the list.
	world.getEntity(lastPokedIndex-2).deleteFromWorld();
	world.getEntity(lastPokedIndex-3).deleteFromWorld();

	// since entity has been deleted the subscription list shrunk, moving the target index back one.
	// if the system does not compensate we could accidentally skip one or more pokes.

	// set all poked entries to an easily observable Value.
	for (int i = 0; i <= lastPokedIndex; i++) {
		penguins[i].pokes = INVALID_POKE_COUNT;
	}

	// process a bit more! notice: we delete entities, so the interval changed!
	world.delta=1/8f;
	world.process();

	for (int i = 0; i <= lastPokedIndex; i++) {
		Assert.assertEquals("Should continue at the new index.", INVALID_POKE_COUNT, penguins[i].pokes);
	}
	Assert.assertEquals("Should continue at the new index.", 1, penguins[lastPokedIndex + 1].pokes);
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:30,代码来源:SpreadProcessingSystemTest.java

示例8: Should_be_unaffected_by_deletion_of_entities_not_processed_yet

import com.artemis.World; //导入方法依赖的package包/类
@Test
public void Should_be_unaffected_by_deletion_of_entities_not_processed_yet() {
	final World world = bakeWorld(new MySpreadProcessingSystem(10, 1));
	world.delta=0.5f;
	world.process();

	final int lastPokedIndex = getLastPokedIndex();

	// take out two entities that have been poked in this pass. This should shift the list.
	world.getEntity(lastPokedIndex+1).deleteFromWorld();
	world.getEntity(lastPokedIndex+2).deleteFromWorld();

	// since entity has been deleted the subscription list shrunk, moving the target index back one.
	// if the system does not compensate we could accidentally skip one or more pokes.

	// set all poked entries to an easily observable Value.
	for (int i = 0; i <= lastPokedIndex+2; i++) {
		penguins[i].pokes = INVALID_POKE_COUNT;
	}

	// process a bit more! notice: we delete entities, so the interval changed!
	world.delta=1/8f;
	world.process();

	for (int i = 0; i <= lastPokedIndex+2; i++) {
		Assert.assertEquals("Should continue at the new index.", INVALID_POKE_COUNT, penguins[i].pokes);
	}
	Assert.assertEquals("Should continue at the new index.", 1, penguins[lastPokedIndex + 3].pokes);
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:30,代码来源:SpreadProcessingSystemTest.java

示例9: test_Dispatch_OneListeningSystem_SystemReceivesEvent

import com.artemis.World; //导入方法依赖的package包/类
public void test_Dispatch_OneListeningSystem_SystemReceivesEvent() {
    WorldConfiguration config = new WorldConfiguration();
    final EventSystem eventManager = new EventSystem();
    config.setSystem(eventManager);
    ReceiveTestSystem s1 = new ReceiveTestSystem();
    config.setSystem(s1);
    config.setSystem(new DispatchTestSystem());

    World w = new World(config);
    w.process();
    assertEquals(1, s1.count);
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:13,代码来源:InterSystemEventGwtTest.java

示例10: test_Dispatch_NoListeningSystem_NoExceptions

import com.artemis.World; //导入方法依赖的package包/类
public void test_Dispatch_NoListeningSystem_NoExceptions() {
    final WorldConfiguration config = new WorldConfiguration();
    final EventSystem eventManager = new EventSystem();
    config.setSystem(eventManager);
    config.setSystem(new DispatchTestSystem());
    World w = new World(config);
    w.process();
    // no exception = success
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:10,代码来源:InterSystemEventGwtTest.java

示例11: test_runartemis_processsimplesystem_noexceptions

import com.artemis.World; //导入方法依赖的package包/类
public void test_runartemis_processsimplesystem_noexceptions() throws Exception {
    WorldConfiguration config = new WorldConfiguration();
    config.setSystem(new TagManager());

    CountingTestSystem s = new CountingTestSystem();
    config.setSystem(s);

    World w = new World(config);
    w.process();

    assertEquals(1, s.count);
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:13,代码来源:BasicArtemisGwtTest.java

示例12: Should_not_step_over_entities_when_subscription_list_shrinks

import com.artemis.World; //导入方法依赖的package包/类
@Test
public void Should_not_step_over_entities_when_subscription_list_shrinks() {
	final World world = bakeWorld(new MyTimeboxedProcessingSystem(20, 0.01f, 0.05f, 0));

	world.process();

	final int lastPokedIndex = getLastPokedIndex();

	// take out two entities that have been poked in this pass. This should shift the list.
	world.getEntity(lastPokedIndex-2).deleteFromWorld();
	world.getEntity(lastPokedIndex-3).deleteFromWorld();

	// since entity has been deleted the subscription list shrunk, moving the target index back one.
	// if the system does not compensate we could accidentally skip one or more pokes.

	// set all poked entries to an easily observable Value.
	for (int i = 0; i <= lastPokedIndex; i++) {
		penguins[i].pokes = INVALID_POKE_COUNT;
	}

	world.process();

	for (int i = 0; i <= lastPokedIndex; i++) {
		Assert.assertEquals("Should continue at the new index.", INVALID_POKE_COUNT, penguins[i].pokes);
	}
	Assert.assertEquals("Should continue at the new index.", 1, penguins[lastPokedIndex + 1].pokes);
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:28,代码来源:TimeboxedProcessingSystemTest.java

示例13: Should_be_unaffected_by_deletion_of_entities_not_processed_yet

import com.artemis.World; //导入方法依赖的package包/类
@Test
public void Should_be_unaffected_by_deletion_of_entities_not_processed_yet() {
	final World world = bakeWorld(new MyTimeboxedProcessingSystem(20, 0.01f, 0.05f, 0));

	world.process();

	final int lastPokedIndex = getLastPokedIndex();

	// take out two entities that have been poked in this pass. This should shift the list.
	world.getEntity(lastPokedIndex+1).deleteFromWorld();
	world.getEntity(lastPokedIndex+2).deleteFromWorld();

	// since entity has been deleted the subscription list shrunk, moving the target index back one.
	// if the system does not compensate we could accidentally skip one or more pokes.

	// set all poked entries to an easily observable Value.
	for (int i = 0; i <= lastPokedIndex+2; i++) {
		penguins[i].pokes = INVALID_POKE_COUNT;
	}

	world.process();

	for (int i = 0; i <= lastPokedIndex+2; i++) {
		Assert.assertEquals("Should continue at the new index.", INVALID_POKE_COUNT, penguins[i].pokes);
	}

	Assert.assertEquals("Should continue at the new index.", 1, penguins[lastPokedIndex + 3].pokes);
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:29,代码来源:TimeboxedProcessingSystemTest.java

示例14: Should_not_crash_when_invalid_index

import com.artemis.World; //导入方法依赖的package包/类
@Test
public void Should_not_crash_when_invalid_index() throws Exception {
	final World world = bakeWorld(new MyTimeboxedProcessingSystem(10, 0.01f, 0.08f, 0));
	world.process();
	// purge entities. index is now invalid.
	for (int i = 0; i < 10; i++) {
		world.getEntity(i).deleteFromWorld();
	}
	// explode?
	world.process();
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:12,代码来源:TimeboxedProcessingSystemTest.java

示例15: Should_process_entity_When_sufficient_small_deltas_combine

import com.artemis.World; //导入方法依赖的package包/类
@Test
public void Should_process_entity_When_sufficient_small_deltas_combine() {
	final World world = bakeWorld(new MySpreadProcessingSystem(10, 1));
	world.delta=0.025f;
	world.process();
	world.process();
	world.process();
	world.process();

	Assert.assertEquals("Penguin #0 wrong pokes.", 1, penguins[0].pokes);
	for (int i=1;i<9;i++ ) {
		Assert.assertEquals("Penguin #" + i + " wrong pokes.", 0, penguins[i].pokes);
	}
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:15,代码来源:SpreadProcessingSystemTest.java


注:本文中的com.artemis.World.process方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。