Libgdx - 改变精灵中的像素图透明度

时间:2016-04-14 19:18:57

标签: android libgdx

我正在创建一种效果,当我点击商店项目时,它会使屏幕变暗并弹出一些消息。所以消息和正在绘制的精灵正常淡入淡出。但是在其中有pixmap的精灵不会褪色。

    Pixmap pixmap = new Pixmap(800, 1000, Pixmap.Format.RGBA8888);
    pixmap.setColor(0.25f, 0.25f, 0.25f, 0.75f);
    pixmap.fillRectangle(0, 0, 800, 1000);
    texture = new Texture(pixmap);
    sprite = new Sprite(texture);
    pixmap.dispose();

这是精灵

    sprite.setColor(sprite.getColor().r, sprite.getColor().g, sprite.getColor().b, notification_alpha);
    game.batch.draw(sprite, -400, -500);

0 个答案:

没有答案
相关问题