Class MainGameOrderBtnDisplay
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.components.ordersystem.MainGameOrderBtnDisplay
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable,Renderable,Comparable<Renderable>
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.
-
Field Summary
Fields inherited from class com.csse3200.game.ui.UIComponent
skin, stage -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the button to the UI and sets up the event listener for the button click.voidcreate()Initialises the button display and sets up the actors in the UI.voiddispose()Removes the buttonvoiddraw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draws the button on the screen.booleangetState()Get the state of the buttoncom.badlogic.gdx.scenes.scene2d.ui.TablegetTable()floatReturns the z-index for this component.voidsetStage(com.badlogic.gdx.scenes.scene2d.Stage mock) Disposes of the button display, clearing the table and removing it from the stage.voidsetState(boolean pressed) Methods inherited from class com.csse3200.game.ui.UIComponent
getLayerMethods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, renderMethods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, updateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.csse3200.game.rendering.Renderable
render
-
Constructor Details
-
MainGameOrderBtnDisplay
public MainGameOrderBtnDisplay()
-
-
Method Details
-
create
public void create()Initialises the button display and sets up the actors in the UI.- Overrides:
createin classUIComponent
-
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:
drawin classRenderComponent- 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:
getZIndexin interfaceRenderable- Overrides:
getZIndexin classUIComponent- 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:
disposein interfacecom.badlogic.gdx.utils.Disposable- Overrides:
disposein classRenderComponent
-