LibGDX设置State的背景透明

时间:2016-09-06 10:58:36

标签: android-studio opengl-es libgdx

当角色死亡时,我在屏幕上呈现gameover.png,但是它的背景通过Gdx.gl.glClearColor(1, 0, 0, 150);&主要课程中Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

我想要的是将gameover.png堆栈叠加到当前的游戏状态,因为角色会死掉。

我不能接受这里的答案,因为我的主要类继承自ApplicationAdapterBackground transparency in libgdx

1 个答案:

答案 0 :(得分:0)

Gdx.gl.glClearColor只是用您设置的颜色清除屏幕。如果你想在另一个上绘制图像,你需要稍后再渲染

    //in your render function
    Gdx.gl.glClearColor(1, 0, 0, 150);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    //drawing your elements
    batch.draw(...);

    //here you can draw your gameover.png
    if(gameOver)
        batch.draw(...)
相关问题