Class PopUpHelper
java.lang.Object
com.csse3200.game.ui.pop_up_dialog_box.PopUpHelper
A helper class for displaying popup dialogs.
Provides a simple interface for creating and showing a
PopupDialogBox
with a single page of content.-
Constructor Summary
ConstructorsConstructorDescriptionPopUpHelper
(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage) Constructs a new PopUpHelper. -
Method Summary
Modifier and TypeMethodDescriptionvoid
displayDialog
(String title, String content, String animalImagePath, float width, float height, int animalIndex) void
displayDialog
(String title, String content, String animalImagePath, float width, float height, int animalIndex, Runnable callback) Displays a popup dialog with the specified title, content, animal image, and dimensions.
-
Constructor Details
-
PopUpHelper
public PopUpHelper(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage) Constructs a new PopUpHelper.- Parameters:
skin
- The skin to be used for the UI elements in the dialog.stage
- The stage on which to display the dialog.
-
-
Method Details
-
displayDialog
public void displayDialog(String title, String content, String animalImagePath, float width, float height, int animalIndex, Runnable callback) Displays a popup dialog with the specified title, content, animal image, and dimensions.- Parameters:
title
- The title of the dialog.content
- The content to be displayed in the dialog.animalImagePath
- Path to the image of the animal to be displayed.width
- The width of the dialog box.height
- The height of the dialog box.animalIndex
- The index of the selected animal (0 for bird, 1 for croc, 2 for dog).callback
- A Runnable to be executed when the dialog is closed.
-
displayDialog
-