Drawing pause Screen as a layer over the play screen-LibGdx

前端 未结 2 1177
耶瑟儿~
耶瑟儿~ 2021-01-26 08:02

In my LibGdx Game I created pause functionality.While playing game,If I press pause button,a separate screen with resume button displays.

What actually I want to do is t

2条回答
  •  庸人自扰
    2021-01-26 08:13

    Short answer: yes, you can. First let your pause screen extend the Stage class instead of the Screen class. Then try calling the draw of the pause screen after the draw of the game. Something like this:

    public void render(){
        UpdateGame();
        pause_screen.act();
    
        DrawGame();
        pause_screen.draw();
    }
    

    Stop the game updates when the pause screen is open. Off course this is over simplified, but you can look in to it.

提交回复
热议问题