Class SlotMachineDisplay
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.components.slot.SlotMachineDisplay
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,Renderable
,Comparable<Renderable>
A 3-reel slot machine UI that lives in the top bar.
Responsibilities:
- Render a top bar frame with an inner reels area (responsive layout).
- Handle user click to trigger a spin.
- Animate continuous scrolling and smooth stop on target indices.
- Bridge to
SlotEngine
to compute outcomes and apply effects.
-
Field Summary
Fields inherited from class com.csse3200.game.ui.UIComponent
skin, stage
Fields inherited from class com.csse3200.game.rendering.RenderComponent
colour
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a display with a defaultSlotEngine
(no area bound).Creates a display with a boundSlotMachineArea
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Initializes UI hierarchy, loads resources, computes sizes, and applies layout.void
dispose()
Called when the component is disposed.void
draw
(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draw pass also detects stage resize and reapplies layout if needed.float
Z index controls rendering order within a layer.Methods inherited from class com.csse3200.game.ui.UIComponent
getLayer
Methods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, getColour, render, setColour
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, getPriority, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
SlotMachineDisplay
Creates a display with a boundSlotMachineArea
. -
SlotMachineDisplay
public SlotMachineDisplay()Creates a display with a defaultSlotEngine
(no area bound).
-
-
Method Details
-
create
public void create()Initializes UI hierarchy, loads resources, computes sizes, and applies layout.- Overrides:
create
in classUIComponent
-
draw
public void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draw pass also detects stage resize and reapplies layout if needed.- Specified by:
draw
in classRenderComponent
- Parameters:
batch
- Batch to render to.
-
getZIndex
public float getZIndex()Description copied from interface:Renderable
Z index controls rendering order within a layer. Higher Z index is drawn on top.- Specified by:
getZIndex
in interfaceRenderable
- Overrides:
getZIndex
in classUIComponent
- Returns:
- Z index
-
dispose
public void dispose()Description copied from class:Component
Called when the component is disposed. Dispose of any internal resources here.- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
- Overrides:
dispose
in classRenderComponent
-