如何在libgdx中通过SpriteBatch绘制具有一些不透明度的纹理?

时间:2017-08-17 11:02:28

标签: libgdx

我必须绘制一个具有不透明度的Texture。我无法使用Sprite,因为我通过Texture SpriteBatch歪曲draw(Texture texture, float[] spriteVertices, int offset, int count)

在绘图之前设置SpriteBatch的颜色,如此

    Color color = batch.getColor();

    float oldAlpha = color.a;
    color.a = 0.3f;

    batch.setColor(color);
    batch.draw(img, vertices, 0, vertices.length);

    color.a = oldAlpha;
    batch.setColor(color);

不起作用。似乎唯一可能的方法是使用Sprite,但我需要Texture来获得上述方法。

0 个答案:

没有答案