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