Package com.csse3200.game.screens
Class WinScreen
java.lang.Object
com.badlogic.gdx.ScreenAdapter
com.csse3200.game.screens.WinScreen
- All Implemented Interfaces:
com.badlogic.gdx.Screen
public class WinScreen
extends com.badlogic.gdx.ScreenAdapter
Screen shown when the player achieves victory.
This class extends BaseScreen
and provides the
specific UI entity for the win scenario. The UI includes:
- A "Victory" title
- Round and elapsed time labels
- Buttons for continuing the game or returning to the main menu
Common lifecycle management (services, renderer, asset loading/unloading,
and background creation) is handled by BaseScreen
.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Entity
createUIScreen
(com.badlogic.gdx.scenes.scene2d.Stage stage) Provides the UI entity for the win screen.void
dispose()
void
render
(float delta) void
resize
(int width, int height) void
updateTime
(long second) Methods inherited from class com.badlogic.gdx.ScreenAdapter
hide, pause, resume, show
-
Field Details
-
game
Game instance for navigation and context. -
renderer
Renderer responsible for drawing.
-
-
Constructor Details
-
WinScreen
Constructs a new WinScreen instance.This will:
- Register services with
ServiceLocator
- Create a renderer and position its camera
- Load required assets
- Build the UI (via
createUIScreen(Stage stage)
)
- Parameters:
game
- theGdxGame
instance, used for screen navigation
- Register services with
-
-
Method Details
-
createUIScreen
Provides the UI entity for the win screen.This entity includes:
BaseEndScreenDisplays
— the victory UI (title, round/time labels, buttons)InputDecorator
— captures and forwards input events to the stage
- Parameters:
stage
- stage for UI- Returns:
- the UI
Entity
for the win screen
-
updateTime
public void updateTime(long second) -
render
public void render(float delta) - Specified by:
render
in interfacecom.badlogic.gdx.Screen
- Overrides:
render
in classcom.badlogic.gdx.ScreenAdapter
-
resize
public void resize(int width, int height) - Specified by:
resize
in interfacecom.badlogic.gdx.Screen
- Overrides:
resize
in classcom.badlogic.gdx.ScreenAdapter
-
dispose
public void dispose()- Specified by:
dispose
in interfacecom.badlogic.gdx.Screen
- Overrides:
dispose
in classcom.badlogic.gdx.ScreenAdapter
-