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 SummaryFields 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.OverlayGENERAL_FORM_PADDING
 
- 
 - 
Constructor SummaryConstructors Constructor Description HeadsUpDisplay(com.badlogic.gdx.graphics.g2d.SpriteBatch batch, MetricController.Metric[] leftMetrics, MetricController.Metric[] rightMetrics)Creates a newHeadsUpDisplayrelating to the givenSpriteBatch
 - 
Method SummaryAll 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- 
metricLabelsprivate 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_STYLEprivate 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- 
HeadsUpDisplayHeadsUpDisplay(com.badlogic.gdx.graphics.g2d.SpriteBatch batch, MetricController.Metric[] leftMetrics, MetricController.Metric[] rightMetrics)Creates a newHeadsUpDisplayrelating to the givenSpriteBatch- Parameters:
- batch- The- SpriteBatchto which the- HeadsUpDisplayshould be connected
- leftMetrics- The- MetricController.Metricelements to be displayed on the left-hand side
- rightMetrics- The- MetricController.Metricelements to be displayed on the right-hand side
 
 
- 
 - 
Method Detail- 
updateMetricTextpublic void updateMetricText(MetricController.Metric metric, java.lang.String text) Update theMetricController.Metriclabel with the given value- Specified by:
- updateMetricTextin interface- MetricListener
- Parameters:
- metric- The key of the- MetricController.Metricto update
- text- The new text
 
 - 
addLabelprivate 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- The- MetricController.Metricassociated with the- Label
 
 
- 
 
-