java.lang.Object
com.badlogic.gdx.ApplicationAdapter
com.devcharles.piazzapanic.scene2d.Hud
All Implemented Interfaces:
com.badlogic.gdx.ApplicationListener

public class Hud extends com.badlogic.gdx.ApplicationAdapter
HUD user interface rendering for the game, also includes the win screen.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Integer
     
    private final float
     
    private com.badlogic.gdx.Game
     
    private GameScreen
     
    (package private) com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle
     
    boolean
     
    (package private) com.badlogic.gdx.scenes.scene2d.ui.Label
     
    private boolean
     
    private com.badlogic.gdx.scenes.scene2d.ui.Image
     
    private Integer[]
     
    (package private) com.badlogic.gdx.scenes.scene2d.ui.Label
     
    (package private) com.badlogic.gdx.scenes.scene2d.ui.Label
     
    private com.badlogic.gdx.scenes.scene2d.ui.Skin
     
    com.badlogic.gdx.scenes.scene2d.Stage
     
    private com.badlogic.gdx.scenes.scene2d.ui.Table
     
    private com.badlogic.gdx.scenes.scene2d.ui.Table
     
    private com.badlogic.gdx.scenes.scene2d.ui.Table
     
    private com.badlogic.gdx.scenes.scene2d.ui.Table
     
    private com.badlogic.gdx.scenes.scene2d.ui.Table
     
    private float
     
    (package private) com.badlogic.gdx.scenes.scene2d.ui.Label
     
    (package private) com.badlogic.gdx.scenes.scene2d.ui.Label
     
    (package private) com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle
     
    boolean
     
    (package private) com.badlogic.gdx.graphics.g2d.BitmapFont
     
    (package private) com.badlogic.gdx.graphics.g2d.BitmapFont
     
    private com.badlogic.gdx.utils.viewport.Viewport
     
    boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Hud(com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch, GameScreen savedGame, com.badlogic.gdx.Game game, Integer[] reputationPoints)
    Create the hud.
  • Method Summary

    Modifier and Type
    Method
    Description
    private com.badlogic.gdx.scenes.scene2d.utils.ClickListener
    createListener(com.badlogic.gdx.Screen screen)
     
    private void
     
    void
    Called when the Application is destroyed.
    void
    Called when the Application is paused, usually when it's not active or visible on-screen.
    void
    resize(int width, int height)
    Called when the Application is resized.
    void
    Called when the Application is resumed from a paused state, usually when it regains focus.
    void
    update(float deltaTime)
    Render the hud.
    void
    Update HUD inventory section.
    void
    Update the current orders HUD section.
    private void
    win()
    Win screen

    Methods inherited from class com.badlogic.gdx.ApplicationAdapter

    create, render

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • stage

      public com.badlogic.gdx.scenes.scene2d.Stage stage
    • viewport

      private com.badlogic.gdx.utils.viewport.Viewport viewport
    • customerTimer

      private Integer customerTimer
    • timeCounter

      private float timeCounter
    • reputation

      private Integer[] reputation
    • skin

      private com.badlogic.gdx.scenes.scene2d.ui.Skin skin
    • fontScale

      private final float fontScale
      See Also:
    • hudLabelStyle

      com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle hudLabelStyle
    • titleLabelStyle

      com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle titleLabelStyle
    • timerLabel

      com.badlogic.gdx.scenes.scene2d.ui.Label timerLabel
    • timeNameLabel

      com.badlogic.gdx.scenes.scene2d.ui.Label timeNameLabel
    • reputationLabel

      com.badlogic.gdx.scenes.scene2d.ui.Label reputationLabel
    • reputationNameLabel

      com.badlogic.gdx.scenes.scene2d.ui.Label reputationNameLabel
    • pausedNameLabel

      com.badlogic.gdx.scenes.scene2d.ui.Label pausedNameLabel
    • uiFont

      com.badlogic.gdx.graphics.g2d.BitmapFont uiFont
    • uiTitleFont

      com.badlogic.gdx.graphics.g2d.BitmapFont uiTitleFont
    • photo

      private com.badlogic.gdx.scenes.scene2d.ui.Image photo
    • game

      private com.badlogic.gdx.Game game
    • tableBottom

      private com.badlogic.gdx.scenes.scene2d.ui.Table tableBottom
    • tableRight

      private com.badlogic.gdx.scenes.scene2d.ui.Table tableRight
    • tableTop

      private com.badlogic.gdx.scenes.scene2d.ui.Table tableTop
    • tablePause

      private com.badlogic.gdx.scenes.scene2d.ui.Table tablePause
    • tableBottomLabel

      private com.badlogic.gdx.scenes.scene2d.ui.Table tableBottomLabel
    • pauseToggled

      private boolean pauseToggled
    • paused

      public boolean paused
    • gameScreen

      private GameScreen gameScreen
    • won

      public boolean won
    • triggerWin

      public boolean triggerWin
  • Constructor Details

    • Hud

      public Hud(com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch, GameScreen savedGame, com.badlogic.gdx.Game game, Integer[] reputationPoints)
      Create the hud.
      Parameters:
      spriteBatch - the batch to draw the HUD with
      savedGame - reference to the screen drawing the hud to switch back to in case of screen transitions.
      game - PiazzaPanic instance for switching screens.
      reputationPoints - Must be an object to pass by reference, see https://stackoverflow.com/questions/3326112/java-best-way-to-pass-int-by-reference
  • Method Details

    • createTables

      private void createTables()
    • updateInventory

      public void updateInventory(FoodComponent.FoodType[] inventory)
      Update HUD inventory section.
      Parameters:
      inventory - array of FoodComponent.FoodType to display.
    • updateOrders

      public void updateOrders(FoodComponent.FoodType[] orders)
      Update the current orders HUD section.
      Parameters:
      orders - array of FoodComponent.FoodType to display.
    • update

      public void update(float deltaTime)
      Render the hud. If triggerWin is true when this runs, the Win screen will be shown.
      Parameters:
      deltaTime - the time elapsed since last frame.
    • pause

      public void pause()
      Description copied from interface: com.badlogic.gdx.ApplicationListener
      Called when the Application is paused, usually when it's not active or visible on-screen. An Application is also paused before it is destroyed.
      Specified by:
      pause in interface com.badlogic.gdx.ApplicationListener
      Overrides:
      pause in class com.badlogic.gdx.ApplicationAdapter
    • resume

      public void resume()
      Description copied from interface: com.badlogic.gdx.ApplicationListener
      Called when the Application is resumed from a paused state, usually when it regains focus.
      Specified by:
      resume in interface com.badlogic.gdx.ApplicationListener
      Overrides:
      resume in class com.badlogic.gdx.ApplicationAdapter
    • win

      private void win()
      Win screen
    • resize

      public void resize(int width, int height)
      Description copied from interface: com.badlogic.gdx.ApplicationListener
      Called when the Application is resized. This can happen at any point during a non-paused state but will never happen before a call to ApplicationListener.create().
      Specified by:
      resize in interface com.badlogic.gdx.ApplicationListener
      Overrides:
      resize in class com.badlogic.gdx.ApplicationAdapter
      Parameters:
      width - the new width in pixels
      height - the new height in pixels
    • dispose

      public void dispose()
      Description copied from interface: com.badlogic.gdx.ApplicationListener
      Called when the Application is destroyed. Preceded by a call to ApplicationListener.pause().
      Specified by:
      dispose in interface com.badlogic.gdx.ApplicationListener
      Overrides:
      dispose in class com.badlogic.gdx.ApplicationAdapter
    • createListener

      private com.badlogic.gdx.scenes.scene2d.utils.ClickListener createListener(com.badlogic.gdx.Screen screen)