Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/399.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何将artemis odb和x2B结合起来;格伦·费德勒游戏循环_Java_Libgdx_Game Loop_Artemis - Fatal编程技术网

Java 如何将artemis odb和x2B结合起来;格伦·费德勒游戏循环

Java 如何将artemis odb和x2B结合起来;格伦·费德勒游戏循环,java,libgdx,game-loop,artemis,Java,Libgdx,Game Loop,Artemis,我想在我的游戏中使用artemis() 最近我读到了格伦·费德勒的游戏循环: 因此,提到的游戏循环有两个部分,其中artemis world.process();将会发生。集成部分和渲染部分 你知道我怎样才能用阿耳特弥斯完成这样的事情吗 while(!quit) { ..... while (accumulator >= dt) { world.process("only EntitySystems of group1 or with Components

我想在我的游戏中使用artemis()

最近我读到了格伦·费德勒的游戏循环:

因此,提到的游戏循环有两个部分,其中artemis world.process();将会发生。集成部分和渲染部分

你知道我怎样才能用阿耳特弥斯完成这样的事情吗

while(!quit) {
    .....
    while (accumulator >= dt) {
       world.process("only EntitySystems of group1 or with Components X (INTEGRATE STUFF)");
       ....
    }
    ....
    world.process("only EntitySystems of group2 or with Components Y (RENDER STUFF)");
}
artemis支持这种游戏循环吗

我现在想到的唯一解决办法是:

设置一个全局静态标志,该标志指示其集成还是渲染过程,然后在设置错误标志时退出所有
EntitySystem.process(Entity e)
方法。像这样:

@Override
protected void process(Entity e) {
    if(GLOBAL.RENDER_TIME) {
        return; // exit cause, this entity should only be processed when it is INTEGRATE TIME
    }   
}
这方面的问题是,由于实体不处理任何东西,所以在许多实体上存在不需要的迭代

我曾考虑拥有两个
世界
,但我不认为我可以在
世界
之间轻松共享相同的组件实例,尤其是当它们是池对象时

你知道如何将artemis odb和Glenn Fiedler游戏循环结合起来吗

编辑: 刚刚发现我可以使用
setEnabled()
禁用和启用
EntitySystems
。现在就可以了。

这就是我要找的

我就是这样实施的: