Class HeadsUpDisplay
- java.lang.Object
-
- bytemusketeers.heslingtonhustle.ui.Overlay
-
- bytemusketeers.heslingtonhustle.ui.HeadsUpDisplay
-
- All Implemented Interfaces:
MetricListener,Drawable,com.badlogic.gdx.utils.Disposable
class HeadsUpDisplay extends Overlay implements MetricListener
TheHeadsUpDisplaydisplays persistent player and game information throughout the gameplay.- Author:
- ENG1 Team 23 (Cohort 3)
-
-
Field Summary
Fields Modifier and Type Field Description private static com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyleLABEL_STYLETheLabel.LabelStyleto use for all text; this is standard and shipped with LibGDXprivate java.util.Map<MetricController.Metric,com.badlogic.gdx.scenes.scene2d.ui.Label>metricLabelsA persistent mapping betweenMetricController.Metricelements and theOverlay-specificLabelform elements-
Fields inherited from class bytemusketeers.heslingtonhustle.ui.Overlay
GENERAL_FORM_PADDING
-
-
Constructor Summary
Constructors Constructor Description HeadsUpDisplay(com.badlogic.gdx.graphics.g2d.SpriteBatch batch, MetricController.Metric[] leftMetrics, MetricController.Metric[] rightMetrics)Creates a newHeadsUpDisplayrelating to the givenSpriteBatch
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddLabel(MetricController.Metric metric, com.badlogic.gdx.scenes.scene2d.ui.Table table)Prepares and adds a name-valueLabelpair to the givenTable, and ends the rowvoidupdateMetricText(MetricController.Metric metric, java.lang.String text)Update theMetricController.Metriclabel with the given value
-
-
-
Field Detail
-
metricLabels
private final java.util.Map<MetricController.Metric,com.badlogic.gdx.scenes.scene2d.ui.Label> metricLabels
A persistent mapping betweenMetricController.Metricelements and theOverlay-specificLabelform elements- See Also:
MetricController
-
LABEL_STYLE
private static final com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle LABEL_STYLE
TheLabel.LabelStyleto use for all text; this is standard and shipped with LibGDX
-
-
Constructor Detail
-
HeadsUpDisplay
HeadsUpDisplay(com.badlogic.gdx.graphics.g2d.SpriteBatch batch, MetricController.Metric[] leftMetrics, MetricController.Metric[] rightMetrics)Creates a newHeadsUpDisplayrelating to the givenSpriteBatch- Parameters:
batch- TheSpriteBatchto which theHeadsUpDisplayshould be connectedleftMetrics- TheMetricController.Metricelements to be displayed on the left-hand siderightMetrics- TheMetricController.Metricelements to be displayed on the right-hand side
-
-
Method Detail
-
updateMetricText
public void updateMetricText(MetricController.Metric metric, java.lang.String text)
Update theMetricController.Metriclabel with the given value- Specified by:
updateMetricTextin interfaceMetricListener- Parameters:
metric- The key of theMetricController.Metricto updatetext- The new text
-
addLabel
private void addLabel(MetricController.Metric metric, com.badlogic.gdx.scenes.scene2d.ui.Table table)
Prepares and adds a name-valueLabelpair to the givenTable, and ends the row- Parameters:
metric- TheMetricController.Metricassociated with theLabel
-
-