0
当我尝试拆分纹理时,它不起作用,当我在屏幕上绘制它时,它将绘制与原始纹理相同的4个纹理。我使用下面的代码来分割纹理。TextureRegion拆分不起作用
texture = new Texture(Gdx.files.internal("fondo1.png"));
TextureRegion[][] regs = TextureRegion.split(texture, texture.getWidth()/2, texture.getHeight()/2);
Random rand = new Random();
int x,y;
for (int i=0; i < regs.length; i++){
for (int j = 0; j < regs[i].length; j++){
x = rand.nextInt(500);
y = rand.nextInt(500);
parts.add(new ImageActor(regs[i][j].getTexture(),x,y, regs[i][j].getRegionWidth(), regs[i][j].getRegionHeight()));
}
}
然后,纹理将加载到Actor子类中并通过舞台绘制。
有什么建议吗? 谢谢
它的工作原理,谢谢! – RdlP 2014-11-07 16:02:36