Package controller
Class HUDController
java.lang.Object
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<IHUDElement>
,Collection<IHUDElement>
,Set<IHUDElement>
- See Also:
-
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, contains, remove
Methods inherited from class java.util.LinkedHashSet
spliterator
Methods inherited from class java.util.HashSet
clear, clone, isEmpty, iterator, size, toArray, toArray
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
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.- Specified by:
update
in classAbstractController<IHUDElement>
-
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
- font to usecolor
- 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
- font to usecolor
- 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)
-