I am having trouble implementing a game pause blur screen to render during the gamepause state. I need to take a picture or texture of the current screen i.e gamerunning state, just when the user pauses the screen . Maybe store it to memory, blur it then render it to screen to achieve a nice blur, Gaussian blur effect like they do in popular games like Angry birds.
I tried implementing using a screenshot, but the process of screen capture makes the game freeze for a few seconds which is not nice.
Here is part of my render code
private void updatePlayerForUserInput(float delta)
{
if (Gdx.input.isKeyPressed(Keys.P) || pause)
{
ScreenShotSaver.saveScreenShot();
state = State.GAME_PAUSED;
if(!DEBUG_MODE)
{
toggleGestureProcessor(false);
setBackgroundTexture(new TextureRegion(applyBlurEffect(Gdx.files.external("madboy/screenshot.png"))));
gameScreenGamePauseMenu.sendInMenu();
}
}
}
Can someone help implement s screen like this
This is an example of the effect I desire greatly 1 :enter link description here This is another one, similar thing though 2:enter link description here
This is a part of my update logic depending on game state
private void render(float delta)
{
switch (state)
{
case GAME_READY:
renderReady();
break;
case GAME_RUNNING:
renderRunning(delta);
break;
case GAME_PAUSED:
renderPaused();
break;
case GAME_LEVEL_END:
renderLevelEnd();
break;
case GAME_OVER:
renderGameOver();
break;
}
}
private void update(float delta)
{
switch(state)
{
case GAME_READY:
updateReady();
break;
case GAME_RUNNING:
updateRunning(delta);
break;
case GAME_PAUSED:
updatePaused();
break;
case GAME_LEVEL_END:
updateLevelEnd();
break;
case GAME_OVER:
updateGameOver();
break;
}
}
Iam using Libgdx library and programming in java