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
FieldsModifier and TypeFieldDescriptionprivate Integerprivate final floatprivate com.badlogic.gdx.Gameprivate GameScreen(package private) com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyleboolean(package private) com.badlogic.gdx.scenes.scene2d.ui.Labelprivate booleanprivate com.badlogic.gdx.scenes.scene2d.ui.Imageprivate Integer[](package private) com.badlogic.gdx.scenes.scene2d.ui.Label(package private) com.badlogic.gdx.scenes.scene2d.ui.Labelprivate com.badlogic.gdx.scenes.scene2d.ui.Skincom.badlogic.gdx.scenes.scene2d.Stageprivate com.badlogic.gdx.scenes.scene2d.ui.Tableprivate com.badlogic.gdx.scenes.scene2d.ui.Tableprivate com.badlogic.gdx.scenes.scene2d.ui.Tableprivate com.badlogic.gdx.scenes.scene2d.ui.Tableprivate com.badlogic.gdx.scenes.scene2d.ui.Tableprivate 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.LabelStyleboolean(package private) com.badlogic.gdx.graphics.g2d.BitmapFont(package private) com.badlogic.gdx.graphics.g2d.BitmapFontprivate com.badlogic.gdx.utils.viewport.Viewportboolean -
Constructor Summary
ConstructorsConstructorDescriptionHud(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.ClickListenercreateListener(com.badlogic.gdx.Screen screen) private voidvoiddispose()Called when theApplicationis destroyed.voidpause()Called when theApplicationis paused, usually when it's not active or visible on-screen.voidresize(int width, int height) Called when theApplicationis resized.voidresume()Called when theApplicationis resumed from a paused state, usually when it regains focus.voidupdate(float deltaTime) Render the hud.voidupdateInventory(FoodComponent.FoodType[] inventory) Update HUD inventory section.voidupdateOrders(FoodComponent.FoodType[] orders) Update the current orders HUD section.private voidwin()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-PiazzaPanicinstance 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.FoodTypeto display.
-
updateOrders
Update the current orders HUD section.- Parameters:
orders- array ofFoodComponent.FoodTypeto display.
-
update
public void update(float deltaTime) Render the hud. IftriggerWinis 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.ApplicationListenerCalled when theApplicationis paused, usually when it's not active or visible on-screen. An Application is also paused before it is destroyed.- Specified by:
pausein interfacecom.badlogic.gdx.ApplicationListener- Overrides:
pausein classcom.badlogic.gdx.ApplicationAdapter
-
resume
public void resume()Description copied from interface:com.badlogic.gdx.ApplicationListenerCalled when theApplicationis resumed from a paused state, usually when it regains focus.- Specified by:
resumein interfacecom.badlogic.gdx.ApplicationListener- Overrides:
resumein 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.ApplicationListenerCalled when theApplicationis resized. This can happen at any point during a non-paused state but will never happen before a call toApplicationListener.create().- Specified by:
resizein interfacecom.badlogic.gdx.ApplicationListener- Overrides:
resizein 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.ApplicationListenerCalled when theApplicationis destroyed. Preceded by a call toApplicationListener.pause().- Specified by:
disposein interfacecom.badlogic.gdx.ApplicationListener- Overrides:
disposein classcom.badlogic.gdx.ApplicationAdapter
-
createListener
private com.badlogic.gdx.scenes.scene2d.utils.ClickListener createListener(com.badlogic.gdx.Screen screen)
-