Package controller
Class HUDController
- All Implemented Interfaces:
Iterable<HUDElement>
-
Constructor Summary
ConstructorsConstructorDescriptionHUDController
(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Keeps a set of HUD elements and makes sure they are drawn. -
Method Summary
Modifier and TypeMethodDescriptioncom.badlogic.gdx.scenes.scene2d.ui.Label
drawText
(String text, String fontPath, com.badlogic.gdx.graphics.Color color, int size, int width, int height, int x, int y) Draws a given text on the screen.com.badlogic.gdx.scenes.scene2d.ui.Label
drawText
(String text, String fontPath, com.badlogic.gdx.graphics.Color color, int size, int width, int height, int x, int y, int borderWidth) Draws a given text on the screen.void
update()
Redraws the HUD and all HUD elements.Methods inherited from class controller.AbstractController
add, add, addAll, addAll, clear, clearLayer, contains, forEach, isEmpty, iterator, remove, size, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
spliterator
-
Constructor Details
-
HUDController
public HUDController(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Keeps a set of HUD elements and makes sure they are drawn.- Parameters:
batch
- the batch for the HUD
-
-
Method Details
-
update
public void update()Redraws the HUD and all HUD elements.- Overrides:
update
in classAbstractController<HUDElement>
-
drawText
public com.badlogic.gdx.scenes.scene2d.ui.Label drawText(String text, String fontPath, com.badlogic.gdx.graphics.Color color, int size, int width, int height, int x, int y, int borderWidth) Draws a given text on the screen.- Parameters:
text
- text to drawfontPath
- path to the fontcolor
- color to usesize
- font size to usewidth
- width of the text boxheight
- height of the text boxx
- x-position in pixely
- y-position in pixelborderWidth
- borderWidth for the text- Returns:
- Label (use this to alter text or remove the text later)
-
drawText
public com.badlogic.gdx.scenes.scene2d.ui.Label drawText(String text, String fontPath, com.badlogic.gdx.graphics.Color color, int size, int width, int height, int x, int y) Draws a given text on the screen.- Parameters:
text
- text to drawfontPath
- path to the fontcolor
- color to usesize
- font size to usewidth
- width of the text boxheight
- height of the text boxx
- x-position in pixely
- y-position in pixel- Returns:
- Label (use this to alter text or remove the text later)
-