Class SpaceMiniTransition

java.lang.Object
com.badlogic.gdx.scenes.scene2d.Actor
com.csse3200.game.ui.SpaceMiniTransition

public class SpaceMiniTransition extends com.badlogic.gdx.scenes.scene2d.Actor
The SpaceMiniTransition class represents a screen transition effect used in a LibGDX game. It allows for transitioning between different game screens with a visual effect.

This class extends the LibGDX Actor class and is designed to be used as an actor within a Stage. The transition effect is achieved by moving a transition image diagonally across the screen. When the transition is complete, it can trigger a callback or change to a new game screen.

  • Constructor Summary

    Constructors
    Constructor
    Description
    SpaceMiniTransition(GdxGame game, String alert, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, String alertText)
    Creates a new SpaceMiniTransition instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    act(float delta)
    Updates the actor's state on each frame.
    void
    Disposes of resources used by the SpaceMiniTransition instance.
    void
    draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
    Draws the actor on the screen.
    void
    showDialog(com.badlogic.gdx.scenes.scene2d.Stage stage, Runnable callback)
    Displays the SpaceMiniTransition actor on the specified stage and sets a callback to execute after the transition.

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor

    addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, hit, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, scaleChanged, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setStage, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, sizeChanged, stageToLocalCoordinates, toBack, toFront, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SpaceMiniTransition

      public SpaceMiniTransition(GdxGame game, String alert, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, String alertText)
      Creates a new SpaceMiniTransition instance.
      Parameters:
      game - The main game instance.
      alert - A string representing the type of alert (e.g., "Exit game").
      skin - The skin used for UI elements (not used in this class).
      alertText - The text for the alert (not used in this class).
  • Method Details

    • act

      public void act(float delta)
      Updates the actor's state on each frame.
      Overrides:
      act in class com.badlogic.gdx.scenes.scene2d.Actor
      Parameters:
      delta - The time elapsed since the last frame in seconds.
    • draw

      public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
      Draws the actor on the screen.
      Overrides:
      draw in class com.badlogic.gdx.scenes.scene2d.Actor
      Parameters:
      batch - The batch used for rendering.
      parentAlpha - The alpha value from the parent actor (not used in this class).
    • showDialog

      public void showDialog(com.badlogic.gdx.scenes.scene2d.Stage stage, Runnable callback)
      Displays the SpaceMiniTransition actor on the specified stage and sets a callback to execute after the transition.
      Parameters:
      stage - The Stage where the actor will be displayed.
      callback - The callback to execute after the transition completes.
    • dispose

      public void dispose()
      Disposes of resources used by the SpaceMiniTransition instance. Call this method when the transition effect is no longer needed.