Class Hud
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
Modifier and TypeFieldDescriptionprivate 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
ConstructorDescriptionHud
(com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch, GameScreen savedGame, com.badlogic.gdx.Game game, Integer[] reputationPoints) Create the hud. -
Method Summary
Modifier and TypeMethodDescriptionprivate com.badlogic.gdx.scenes.scene2d.utils.ClickListener
createListener
(com.badlogic.gdx.Screen screen) private void
void
dispose()
Called when theApplication
is destroyed.void
pause()
Called when theApplication
is paused, usually when it's not active or visible on-screen.void
resize
(int width, int height) Called when theApplication
is resized.void
resume()
Called when theApplication
is resumed from a paused state, usually when it regains focus.void
update
(float deltaTime) Render the hud.void
updateInventory
(FoodComponent.FoodType[] inventory) Update HUD inventory section.void
updateOrders
(FoodComponent.FoodType[] orders) Update the current orders HUD section.private void
win()
Win screenMethods inherited from class com.badlogic.gdx.ApplicationAdapter
create, render
-
Field Details
-
stage
public com.badlogic.gdx.scenes.scene2d.Stage stage -
viewport
private com.badlogic.gdx.utils.viewport.Viewport viewport -
customerTimer
-
timeCounter
private float timeCounter -
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
-
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 withsavedGame
- 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
Update HUD inventory section.- Parameters:
inventory
- array ofFoodComponent.FoodType
to display.
-
updateOrders
Update the current orders HUD section.- Parameters:
orders
- array ofFoodComponent.FoodType
to display.
-
update
public void update(float deltaTime) Render the hud. IftriggerWin
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 theApplication
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 interfacecom.badlogic.gdx.ApplicationListener
- Overrides:
pause
in classcom.badlogic.gdx.ApplicationAdapter
-
resume
public void resume()Description copied from interface:com.badlogic.gdx.ApplicationListener
Called when theApplication
is resumed from a paused state, usually when it regains focus.- Specified by:
resume
in interfacecom.badlogic.gdx.ApplicationListener
- Overrides:
resume
in classcom.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 theApplication
is resized. This can happen at any point during a non-paused state but will never happen before a call toApplicationListener.create()
.- Specified by:
resize
in interfacecom.badlogic.gdx.ApplicationListener
- Overrides:
resize
in classcom.badlogic.gdx.ApplicationAdapter
- Parameters:
width
- the new width in pixelsheight
- the new height in pixels
-
dispose
public void dispose()Description copied from interface:com.badlogic.gdx.ApplicationListener
Called when theApplication
is destroyed. Preceded by a call toApplicationListener.pause()
.- Specified by:
dispose
in interfacecom.badlogic.gdx.ApplicationListener
- Overrides:
dispose
in classcom.badlogic.gdx.ApplicationAdapter
-
createListener
private com.badlogic.gdx.scenes.scene2d.utils.ClickListener createListener(com.badlogic.gdx.Screen screen)
-