Class PauseMenuDisplay

All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable, Renderable, Comparable<Renderable>

public class PauseMenuDisplay extends BaseScreenDisplay
Pause menu overlay shown above the main game and HUD.

Renders a full-screen dimmer and a centered panel with actions:

The dimmer is non-interactive (input disabled) so button clicks reach the menu. ESC is handled once to immediately resume gameplay.
  • Constructor Details

    • PauseMenuDisplay

      public PauseMenuDisplay(GdxGame game)
      Creates a new pause menu overlay bound to the given game instance.
      Parameters:
      game - game instance used for screen navigation actions
  • Method Details

    • buildUI

      protected void buildUI(com.badlogic.gdx.scenes.scene2d.ui.Table root)
      Builds the pause UI:
      1. Add a full-screen, non-interactive dimmer (placed on the Stage)
      2. Bring root to the front so the panel sits above the dimmer/HUD
      3. Add title and action buttons
      4. Capture the first ESC key press to resume and remove the listener
      Specified by:
      buildUI in class BaseScreenDisplay
      Parameters:
      root - the fill-parent root table created by BaseScreenDisplay
    • getZIndex

      public float getZIndex()
      High z-index to ensure the pause overlay renders above other UI layers.
      Specified by:
      getZIndex in interface Renderable
      Overrides:
      getZIndex in class BaseScreenDisplay
      Returns:
      draw order value for this UI component
    • dispose

      public void dispose()
      Removes the dimmer from the Stage and delegates to base disposal. Ensures no stale dimmer instances remain if the overlay is recreated later.
      Specified by:
      dispose in interface com.badlogic.gdx.utils.Disposable
      Overrides:
      dispose in class BaseScreenDisplay