0
当我从Image
从一个白色像素(1×1)Texture
获得Drawable
时,其工作正常,但无法更改其颜色。为什么?libGDX:从图像可绘制无法更改其颜色
public static Drawable getDrawable(Texture texture, Color color) {
Image image = new Image(texture);
image.setColor(color);
return image.getDrawable();
}
当我把它叫做:
// can't change color!! ==> still white (default)
getDrawable(pixel, new Color(0, 1f, 0, 0.5f));
任何人都可以咨询我:)。
你在第二个代码块中调用了那个方法?在你的第一个例子中,你为图片着色,而不是绘图,所以它保持白色。 – Tenfour04