Class CottonHud
java.lang.Object
io.github.cottonmc.cotton.gui.client.CottonHud
Manages widgets that are painted on the in-game HUD.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Positioners can be used to change the position of a widget based on the window dimensions. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Adds a new widget to the HUD.static void
Adds a new widget to the HUD at the specified offsets.static void
Adds a new widget to the HUD at the specified offsets and resizes it.static void
add
(WWidget widget, CottonHud.Positioner positioner) Adds a new widget to the HUD with a custom positioner.static void
add
(WWidget widget, CottonHud.Positioner positioner, int width, int height) Adds a new widget to the HUD with a custom positioner and resizes it.static void
Removes the widget from the HUD.static void
setPositioner
(WWidget widget, CottonHud.Positioner positioner) Sets the positioner of the widget.
-
Constructor Details
-
CottonHud
public CottonHud()
-
-
Method Details
-
add
Adds a new widget to the HUD.- Parameters:
widget
- the widget
-
add
Adds a new widget to the HUD at the specified offsets.- Parameters:
widget
- the widgetx
- the x offsety
- the y offset- See Also:
-
add
Adds a new widget to the HUD at the specified offsets and resizes it.- Parameters:
widget
- the widgetx
- the x offsety
- the y offsetwidth
- the width of the widgetheight
- the height of the widget- See Also:
-
add
Adds a new widget to the HUD with a custom positioner.- Parameters:
widget
- the widgetpositioner
- the positioner
-
add
Adds a new widget to the HUD with a custom positioner and resizes it.- Parameters:
widget
- the widgetpositioner
- the positionerwidth
- the width of the widgetheight
- the height of the widget
-
setPositioner
Sets the positioner of the widget.- Parameters:
widget
- the widgetpositioner
- the positioner
-
remove
Removes the widget from the HUD.- Parameters:
widget
- the widget
-