package com.pqbyte.coherence;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;

public class PauseScreen extends ScreenAdapter {

  private Stage stage;
  private Coherence game;

  /**
   * The screen that comes up when game is paused.
   *
   * @param game The game instance.
   */
  public PauseScreen(Coherence game) {
    this.game = game;
    Skin skin = new Skin(Gdx.files.internal("skin/uiskin.json"));
    stage = new Stage();
    Table table = new Table();
    table.setFillParent(true);
    stage.addActor(table);

    Label titleLabel = createTitleLabel(skin);
    table.add(titleLabel).spaceBottom(160);
    table.row();
    Button button = createButton(skin);
    table.add(button).width(300).height(60);

    table.setDebug(Constants.isDebug());

    Gdx.input.setInputProcessor(stage);
  }

  @Override
  public void render(float delta) {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.act(delta);
    stage.draw();
  }

  @Override
  public void dispose() {
    stage.dispose();
  }

  private Label createTitleLabel(Skin skin) {
    Label label = new Label("Game paused", skin);

    // Double font size
    label.setSize(label.getWidth() * 2, label.getHeight());
    label.setFontScale(2);

    return label;
  }

  private Button createButton(Skin skin) {
    TextButton button = new TextButton("RESUME GAME", skin, "default");

    button.addListener(new ClickListener() {
      @Override
      public void clicked(InputEvent event, float xPos, float yPos) {
        game.setScreen(game.getPreviousScreen());
        Gdx.input.setInputProcessor(game.getPreviousInputProcessor());
        dispose();
      }
    });

    return button;
  }
}

@@ -1399,25 +1399,133 @@
 %0A    Button 
-b
+resumeButton = createResumeButton(skin);%0A    table.add(resumeButton).width(300).height(60);%0A%0A    Button mainB
 utton = crea
@@ -1522,24 +1522,28 @@
 ton = create
+Main
 Button(skin)
@@ -1558,17 +1558,119 @@
 ble.add(
-b
+mainButton).width(300).height(60);%0A%0A    Button exitButton = createExitButton(skin);%0A    table.add(exitB
 utton).w
@@ -2275,16 +2275,22 @@
 n create
+Resume
 Button(S
@@ -2551,24 +2551,24 @@
 sScreen());%0A
-
         Gdx.
@@ -2658,24 +2658,799 @@
  %7D%0A    %7D);%0A%0A
+    return button;%0A  %7D%0A%0A  private Button createMainButton(Skin skin) %7B%0A    TextButton button = new TextButton(%22RETURN TO MAIN MENU%22, skin, %22default%22);%0A%0A    button.addListener(new ClickListener() %7B%0A      @Override%0A      public void clicked(InputEvent event, float xPos, float yPos) %7B%0A        game.setScreen(new MenuScreen(game));%0A        //Gdx.input.setInputProcessor(game.getPreviousInputProcessor());%0A        dispose();%0A      %7D%0A    %7D);%0A%0A    return button;%0A  %7D%0A%0A  private Button createExitButton(Skin skin) %7B%0A    TextButton button = new TextButton(%22EXIT THE GAME%22, skin, %22default%22);%0A%0A    button.addListener(new ClickListener() %7B%0A      @Override%0A      public void clicked(InputEvent event, float xPos, float yPos) %7B%0A        Gdx.app.exit();%0A        dispose();%0A      %7D%0A    %7D);%0A%0A
     return b

Add exit and main menu button to PauseScreen