2 resim için doku çizimi kullandım, ancak arka plan resmi siyah oluyor. Kaynak resim png ve şeffaf. Bunu nasıl çözebilirim?libgdx texture image saydam hale getirme
Orijinal görüntüyü nasıl şeffaf hale getirebilirim?
2 resim için doku çizimi kullandım, ancak arka plan resmi siyah oluyor. Kaynak resim png ve şeffaf. Bunu nasıl çözebilirim?libgdx texture image saydam hale getirme
Orijinal görüntüyü nasıl şeffaf hale getirebilirim?
Daha önce devre dışı bıraktıysanız, spritebatch.enableBlending()
'u deneyin. Varsayılan olarak etkin olmalıdır.
Bu deneyin:
spriteBatch.begin();
//background
seaTexture = new Texture(px);
Color c = spriteBatch.getColor();
spriteBatch.setColor(c.r, c.g, c.b, 1f); //set alpha to 1
spriteBatch.draw(seaTexture, 0, 0, 480, 320);
//foreground
c = spriteBatch.getColor();
spriteBatch.setColor(c.r, c.g, c.b, .3f);//set alpha to 0.3
spriteBatch.draw(blockTexture, 50, 100, 120, 120);
spriteBatch.end();
Bu hat 'Gdx.gl.glClear (GL20.GL_COLOR_BUFFER_BIT) birinci ekranı temizlemek için gerekli; başına alfa etkilerini görmek için 'spriteBatch.begin()' önce' [burada talimatlar] (https://github.com/libgdx/libgdx/wiki/Spritebatch ,-Textureregions ,-and-Sprites) – rockhammer
Elbette bunu yapmalısınız. Sadece kodun en önemli kısmını gösterdim. – Nolesh