Class MainGameOrderBtnDisplay

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

public class MainGameOrderBtnDisplay extends UIComponent
Displays a button on the main game screen that allows players to create a new order. The button is positioned in the bottom right corner of the screen.
  • Constructor Details

    • MainGameOrderBtnDisplay

      public MainGameOrderBtnDisplay()
  • Method Details

    • create

      public void create()
      Initialises the button display and sets up the actors in the UI.
      Overrides:
      create in class UIComponent
    • getTable

      public com.badlogic.gdx.scenes.scene2d.ui.Table getTable()
    • addActors

      public void addActors()
      Adds the button to the UI and sets up the event listener for the button click. When the "Create Order" button is clicked, it triggers the "createOrder" event.
    • draw

      public void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)
      Draws the button on the screen. The actual rendering is handled by the stage, so this method is empty.
      Specified by:
      draw in class RenderComponent
      Parameters:
      batch - the sprite batch used for drawing.
    • getZIndex

      public float getZIndex()
      Returns the z-index for this component. The z-index determines the rendering order of UI components.
      Specified by:
      getZIndex in interface Renderable
      Overrides:
      getZIndex in class UIComponent
      Returns:
      the z-index for this component.
    • setStage

      public void setStage(com.badlogic.gdx.scenes.scene2d.Stage mock)
      Disposes of the button display, clearing the table and removing it from the stage.
    • getState

      public boolean getState()
      Get the state of the button
      Returns:
      true if button is pressed, false otherwise
    • setState

      public void setState(boolean pressed)
    • dispose

      public void dispose()
      Removes the button
      Specified by:
      dispose in interface com.badlogic.gdx.utils.Disposable
      Overrides:
      dispose in class RenderComponent