Interface CottonHud.Positioner
- Enclosing class:
CottonHud
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Positioners can be used to change the position of a widget based on the window dimensions.
-
Method Summary
Modifier and TypeMethodDescriptionstatic CottonHud.Positioner
horizontallyCentered
(int y) Creates a new positioner that centers widgets on the X axis and offsets them on the Y axis.static CottonHud.Positioner
of
(int x, int y) Creates a new positioner that offsets widgets.void
reposition
(WWidget widget, int hudWidth, int hudHeight) Repositions the widget according to the HUD dimensions.
-
Method Details
-
reposition
Repositions the widget according to the HUD dimensions.- Parameters:
widget
- the widgethudWidth
- the width of the HUDhudHeight
- the height of the HUD
-
of
Creates a new positioner that offsets widgets.If an offset is negative, the offset is subtracted from the HUD dimension on that axis.
- Parameters:
x
- the x offsety
- the y offset- Returns:
- an offsetting positioner
-
horizontallyCentered
Creates a new positioner that centers widgets on the X axis and offsets them on the Y axis.If the Y offset is negative, the offset is subtracted from the HUD height.
- Parameters:
y
- the y offset- Returns:
- a centering positioner
-