• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EntitySystem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.badlogic.ashley.core.EntitySystem的典型用法代码示例。如果您正苦于以下问题:Java EntitySystem类的具体用法?Java EntitySystem怎么用?Java EntitySystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EntitySystem类属于com.badlogic.ashley.core包,在下文中一共展示了EntitySystem类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSystem

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
private <ES extends EntitySystem> ES getSystem(Class<ES> clazz) {
    ES entitySystem = engine.getSystem(clazz);
    if (entitySystem == null) {
        try {
            Constructor constructor = findConstructor(clazz);
            entitySystem = (ES) constructor.newInstance((Object[]) null);
        } catch (Exception ex) {
            Log.debug(tag, "Error instance entitySystem %s", clazz.getSimpleName());

        }
        if (entitySystem != null) {
            engine.addSystem(entitySystem);
        } else {
            Log.debug(tag, "Error instance entitySystem %s", clazz.getSimpleName());
        }


    }
    return entitySystem;

}
 
开发者ID:Rubentxu,项目名称:GDX-Logic-Bricks,代码行数:22,代码来源:EntityBuilder.java


示例2: dispose

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
@Override
public void dispose() {
	logger.info("dispose");
	
	for (EntitySystem system : engine.getSystems()) {
		if (system instanceof Disposable) {
			((Disposable)system).dispose();
		}
	}
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:11,代码来源:GameScreen.java


示例3: addInputProcessors

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
private void addInputProcessors() {
	logger.info("enabling engine input processors");
	InputMultiplexer inputMultiplexer = Env.getGame().getMultiplexer();
	
	inputMultiplexer.addProcessor(this);
	
	for (EntitySystem system : engine.getSystems()) {
		if (system instanceof InputProcessor) {
			inputMultiplexer.addProcessor((InputProcessor)system);
		}
	}
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:13,代码来源:GameScreen.java


示例4: removeInputProcessors

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
private void removeInputProcessors() {
	logger.info("disabling engine input processors");
	InputMultiplexer inputMultiplexer = Env.getGame().getMultiplexer();
	
	inputMultiplexer.removeProcessor(this);
	
	for (EntitySystem system : engine.getSystems()) {
		if (system instanceof InputProcessor) {
			inputMultiplexer.removeProcessor((InputProcessor)system);
		}
	}
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:13,代码来源:GameScreen.java


示例5: renderSystems

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
private void renderSystems() {
	for (EntitySystem system : getEngine().getSystems()) {
		if (system instanceof DebugRenderer) {
			DebugRenderer renderer = (DebugRenderer)system;
			renderer.render(shapeRenderer);
		}
	}
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:9,代码来源:RenderingSystem.java


示例6: pause

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
@Override
public void pause()
{
	for (EntitySystem sys : engine.getSystems())
	{
		sys.setProcessing(false);
	}
	engine.getSystem(UiSystem.class).setProcessing(true);
	Mappers.gameSettingsMap.get(gameWorld).setPaused(true);
}
 
开发者ID:kLeZ,项目名称:LibGDX-MVC-Tutorial,代码行数:11,代码来源:GameScreen.java


示例7: resume

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
@Override
public void resume()
{
	for (EntitySystem sys : engine.getSystems())
	{
		sys.setProcessing(true);
	}
	Mappers.gameSettingsMap.get(gameWorld).setPaused(false);
}
 
开发者ID:kLeZ,项目名称:LibGDX-MVC-Tutorial,代码行数:10,代码来源:GameScreen.java


示例8: dispose

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
@Override
public void dispose() {
	Gdx.app.log(TAG, "disposing instance");
	removeAllEntities();
	clearPools();
	for (EntitySystem system : getSystems()) {
		if (system instanceof Disposable) {
			((Disposable) system).dispose();
		}
		system = null;
		removeSystem(system);
	}
}
 
开发者ID:libgdx-jam,项目名称:GDXJam,代码行数:14,代码来源:EntityManager.java


示例9: dispose

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
@Override
public void dispose() {
	System.out.println("Disposing: " + this.getClass().getSimpleName());

	// clean up after self
	// dispose of spritebatches and textures
	for (EntitySystem sys : engine.getSystems()) {
		if (sys instanceof Disposable)
			((Disposable) sys).dispose();
	}

	//TODO: use entity listener instead
	//Family family = Family.all(TextureComponent.class).get();
	//engine.addEntityListener(family, listener);
	//github.com/libgdx/ashley/wiki/How-to-use-Ashley#entity-events
	for (Entity ents : engine.getEntitiesFor(Family.all(TextureComponent.class).get())) {
		TextureComponent tex = ents.getComponent(TextureComponent.class);
		if (tex != null)
			tex.texture.dispose();
	}

	engine.removeAllEntities();//THIS FIXES IT!
	engine = null;


	//System.gc();//not good practice, just testing

	//super.dispose();
}
 
开发者ID:0XDE57,项目名称:SpaceProject,代码行数:30,代码来源:GameScreen.java


示例10: activeLogicBrickSystemProcessing

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
private void activeLogicBrickSystemProcessing(boolean active) {
    Iterator<EntitySystem> it = engine.getSystems().iterator();
    while (it.hasNext()) {
        EntitySystem system = it.next();
        if (system instanceof LogicBrickSystem) system.setProcessing(active);
    }

}
 
开发者ID:Rubentxu,项目名称:GDX-Logic-Bricks,代码行数:9,代码来源:Game.java


示例11: removeAllSystems

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
/**
 * Remove all systems from the ecs engine
 */
public void removeAllSystems() {
    for (EntitySystem system : engine.getSystems()) {
        engine.removeSystem(system);
    }
}
 
开发者ID:SergeySave,项目名称:SpaceGame,代码行数:9,代码来源:ECSManager.java


示例12: show

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
@Override
public void show() {
	Objects.camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	Objects.world = new World(new Vector2(0,0), false);
	
	Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 1f);
			
	entityEngine = new Engine();

	entityEngine.addEntity(EntityUtils.createPlayer());
	
	entityEngine.addSystem(new RemoveEntityTimerSystem());
	entityEngine.addSystem(new PlayerSystem());
	entityEngine.addSystem(new AStarSystem());
	entityEngine.addSystem(new Box2DToSpritePositionSystem());
	entityEngine.addSystem(new LightFollowPlayerSystem());
	entityEngine.addSystem(new MapControllerSystem(game));
	entityEngine.addSystem(new RendererSystem());
	entityEngine.addSystem(new Box2DLightsSystem());
	//entityEngine.addSystem(new Box2DDebugRendererSystem());
	entityEngine.addSystem(new DrawInfoSystem());
	entityEngine.addSystem(new DrawPossibleFloorPlacementsSystem());
	entityEngine.addSystem(new RemoveFloorSystem());
	
	
	ImmutableArray<EntitySystem> systems = entityEngine.getSystems();
	
	for(int i = 0; i < systems.size(); i++){ // It must have a Initializable
		Initializable init = (Initializable) systems.get(i);
		init.init();
	}
	
	for(int i = 0; i < systems.size(); i++){ // It must not have a Createable
		if(systems.get(i) instanceof Createable){
			Createable create = (Createable) systems.get(i);
			create.create();
		}
	}
	
	Objects.camera.zoom = Values.CAMERA_ZOOM;
	Objects.camera.translate(new Vector2(CameraSize.getWidth() / 2, CameraSize.getHeight() / 2));;
}
 
开发者ID:Portals,项目名称:DropTheCube-LD32,代码行数:43,代码来源:PlayScreen.java


示例13: pause

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
public void pause() {
    for (EntitySystem system : engine.getSystems()) {
        system.setProcessing(false);
    }
}
 
开发者ID:Rubentxu,项目名称:GDX-Logic-Bricks,代码行数:6,代码来源:Game.java


示例14: resume

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
public void resume() {
    for (EntitySystem system : engine.getSystems()) {
        system.setProcessing(true);
    }
}
 
开发者ID:Rubentxu,项目名称:GDX-Logic-Bricks,代码行数:6,代码来源:Game.java


示例15: printSystems

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
public static void printSystems(Engine eng) {
	for (EntitySystem sys : eng.getSystems()) {
		System.out.println(sys + " (" + sys.priority + ")");
		
	}
	
}
 
开发者ID:0XDE57,项目名称:SpaceProject,代码行数:8,代码来源:DebugUISystem.java


示例16: addSystem

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
/**
 * Add an entity system to the ecs engine
 *
 * @param system - the entity system to add
 */
public void addSystem(EntitySystem system) {
    engine.addSystem(system);
}
 
开发者ID:SergeySave,项目名称:SpaceGame,代码行数:9,代码来源:ECSManager.java


示例17: removeSystem

import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
/**
 * Remove an entity system from the ecs engine
 *
 * @param system - the entity system to remove
 */
public void removeSystem(EntitySystem system) {
    engine.removeSystem(system);
}
 
开发者ID:SergeySave,项目名称:SpaceGame,代码行数:9,代码来源:ECSManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CommonTokenFactory类代码示例发布时间:2022-05-21
下一篇:
Java ECConstants类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap