Package tripleplay.util
Class Hud
java.lang.Object
tripleplay.util.Hud
- Direct Known Subclasses:
Hud.Stock
Maintains a (usually debugging) HUD with textual information displayed in one or two columns.
The text is all rendered to a single
Canvas
(and updated only when values change) to put
as little strain on the renderer as possible. Example usage:
class MyGame extends SceneGame {
private Hud.Stock hud = new Hud.Stock(this);
public void init () {
hud.layer.setDepth(Short.MAX_VALUE);
rootLayer.add(hud.layer);
}
}
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A stock HUD that provides a bunch of standard PlayN performance info and handles once-per-second updating. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a static label that spans the width of the HUD.void
Adds a static label and changing value, which will be rendered in two columns.void
add
(react.Value<?> label) Adds a changing label that spans the width of the HUD.setColors
(int textColor, int bgColor) Configures the foreground and background colors.Configures the font used to display the HUD.void
update()
Updates the HUDs rendered image.
-
Field Details
-
layer
The layer that contains this HUD. Add to the scene graph where desired.
-
-
Constructor Details
-
Hud
-
-
Method Details
-
setFont
Configures the font used to display the HUD. Must be called before adding rows. -
setColors
Configures the foreground and background colors. Must be called before adding rows. -
add
Adds a static label that spans the width of the HUD. -
add
public void add(react.Value<?> label) Adds a changing label that spans the width of the HUD. -
add
Adds a static label and changing value, which will be rendered in two columns. -
update
public void update()Updates the HUDs rendered image. Call this after all of its values have been updated (usually once per second).
-