如果我创建一个精灵列表并在场景中绘制它们 - 一切都很好,但是当我尝试制作 spriteGroups 列表并绘制它们时 - 只有黑屏。
private Queue<SpriteGroup> linesToDraw;
...
//when user touch the screen we add sprites to our collection
if (pSceneTouchEvent.getAction() == MotionEvent.ACTION_MOVE)
{
linesToDraw.add(DrawHelper.getBrushLine(xStart, yStart, xEnd, yEnd, 5f,mBitmapTextureAtlas, mFaceTextureRegion, getVertexBufferObjectManager()));
}
...
//here we try to draw sprites
while (linesToDraw.size() > 0)
//this code is reachable
linesToDraw.poll().onDraw(pGLState, mCamera);
...
public static SpriteGroup getBrushLine(float xStart, float yStart,float xEnd, float yEnd, float size,BitmapTextureAtlas atlas, ITextureRegion mFaceTextureRegion, VertexBufferObjectManager manager)
{
SpriteGroup result = new SpriteGroup(atlas, 40, manager);
for (int i = 0; i < count ; i++)
{
Sprite part =new Sprite((float)(xStart + i * sLength * cos), (float)(yStart + i * sLength * sin), mFaceTextureRegion, manager);
result.attachChild(part);
}
return result;
}
...
当我使用单个 SpriteGroup 并将 ArrayList 放入其中时,一切都很好,我可以在场景中看到精灵,但 SpriteGroup 列表不起作用。使用相同的 Texture 和 TextureRegion 创建 SpriteGroup 可能是错误的?