libGDX的实体框架Ashley

作者:

游戏开发之中有时候会使用实体框架,比如Artemis。

在游戏开发中使用实体框架可以极大的提升项目层次和可测试性。

比如利用Artemis,你的游戏代码可能是

publicclass MyGame {

publicvoidMyGame() {
world =new World();

world.setSystem(new MovementSystem());
world.setSystem(new RotationSystem());
world.setSystem(new RenderingSystem());

world.initialize();

while(true) {
world.setDelta(MyGameTimer.getDelta());
world.process();
}
}
}

Ashley

Ashley并没有提供特别的功能,它是一个很简单的实体框架。

它属于Libgdx大家族,但它并不是选用的,你可以继续使用Ash或者Artemis。

使用的时候在你的gradle配置中加上

dependencies {
compile"com.badlogicgames.ashley:ashley:1.0.1"
}

就行了。

具体的使用方法稍后Wiki也会放出的。

最核心的类是EntitySystem。

参考资料

实体系统的好处
API

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注