Class PauseMenuDisplay
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.components.screens.BaseScreenDisplay
com.csse3200.game.components.screens.PauseMenuDisplay
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,Renderable
,Comparable<Renderable>
Pause menu overlay shown above the main game and HUD.
Renders a full-screen dimmer and a centered panel with actions:
- Resume — triggers the entity's
"resume"
event - Restart — switches to
GdxGame.ScreenType.MAIN_GAME
- Main Menu — returns to
GdxGame.ScreenType.MAIN_MENU
-
Field Summary
Fields inherited from class com.csse3200.game.components.screens.BaseScreenDisplay
game, logger, neon, root
Fields inherited from class com.csse3200.game.ui.UIComponent
skin, stage
-
Constructor Summary
ConstructorsConstructorDescriptionPauseMenuDisplay
(GdxGame game) Creates a new pause menu overlay bound to the given game instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
buildUI
(com.badlogic.gdx.scenes.scene2d.ui.Table root) Builds the pause UI: Add a full-screen, non-interactive dimmer (placed on the Stage) Bringroot
to the front so the panel sits above the dimmer/HUD Add title and action buttons Capture the first ESC key press to resume and remove the listenervoid
dispose()
Removes the dimmer from the Stage and delegates to base disposal.float
High z-index to ensure the pause overlay renders above other UI layers.Methods inherited from class com.csse3200.game.components.screens.BaseScreenDisplay
addBody, addTitle, backMainMenu, button, create, draw, makeSolidTexture, solidImage
Methods inherited from class com.csse3200.game.ui.UIComponent
getLayer
Methods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, disableComponent, enableComponent, isDisabled, render
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, getPrio, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.csse3200.game.rendering.Renderable
render
-
Constructor Details
-
PauseMenuDisplay
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:- Add a full-screen, non-interactive dimmer (placed on the Stage)
- Bring
root
to the front so the panel sits above the dimmer/HUD - Add title and action buttons
- Capture the first ESC key press to resume and remove the listener
- Specified by:
buildUI
in classBaseScreenDisplay
- Parameters:
root
- the fill-parent root table created byBaseScreenDisplay
-
getZIndex
public float getZIndex()High z-index to ensure the pause overlay renders above other UI layers.- Specified by:
getZIndex
in interfaceRenderable
- Overrides:
getZIndex
in classBaseScreenDisplay
- 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 interfacecom.badlogic.gdx.utils.Disposable
- Overrides:
dispose
in classBaseScreenDisplay
-