public class Button extends WidgetGroup
| Modifier and Type | Field and Description |
|---|---|
protected java.util.function.Consumer<Button> |
clickFunc |
protected java.util.function.Consumer<Button> |
contextFunc |
protected Widget |
hover |
protected java.util.Collection<TextAPI<?>> |
hoverLines |
protected ShapeWidget |
shape |
protected TextWidget |
text |
scaleX, scaleY, widgets| Constructor and Description |
|---|
Button(@Nullable ShapeWidget shape,
@Nullable TextWidget text,
@Nullable Widget hover) |
| Modifier and Type | Method and Description |
|---|---|
void |
addHoverLine(TextAPI<?> text) |
void |
addHoverLines(java.util.Collection<TextAPI<?>> text) |
void |
addHoverLines(TextAPI<?>... text) |
static Button |
basic(double centerX,
double centerY,
TextAPI<?> text,
java.util.Collection<TextAPI<?>> hoverLines) |
static Button |
basic(double centerX,
double centerY,
TextAPI<?> text,
TextAPI<?>... hoverLines) |
static Button |
basic(TextAPI<?> text,
java.util.Collection<TextAPI<?>> hoverLines) |
static Button |
basic(TextAPI<?> text,
TextAPI<?>... hoverLines) |
static Button |
basic(Vector2 center,
TextAPI<?> text,
java.util.Collection<TextAPI<?>> hoverLines) |
static Button |
basic(Vector2 center,
TextAPI<?> text,
TextAPI<?>... hoverLines) |
static Button |
colored(ColorCache color,
TextAPI<?> text,
java.util.Collection<TextAPI<?>> hoverLines) |
static Button |
colored(ColorCache color,
TextAPI<?> text,
TextAPI<?>... hoverLines) |
static Button |
colored(double centerX,
double centerY,
ColorCache color,
TextAPI<?> text,
java.util.Collection<TextAPI<?>> hoverLines) |
static Button |
colored(double centerX,
double centerY,
ColorCache color,
TextAPI<?> text,
TextAPI<?>... hoverLines) |
static Button |
colored(Vector2 center,
ColorCache color,
TextAPI<?> text,
java.util.Collection<TextAPI<?>> hoverLines) |
static Button |
colored(Vector2 center,
ColorCache color,
TextAPI<?> text,
TextAPI<?>... hoverLines) |
Button |
copy() |
void |
drawHovered(RenderContext ctx,
Vector3 center,
double mouseX,
double mouseY) |
void |
expandShapeHeightToText() |
void |
expandShapeToText() |
void |
expandShapeWidthToText() |
void |
fitShapeHeightToText() |
void |
fitShapeToText() |
void |
fitShapeWidthToText() |
double |
getHeight() |
java.util.Collection<TextAPI<?>> |
getHoverLines(double x,
double y) |
double |
getWidth() |
boolean |
hasNonBlankHoverText() |
boolean |
hasNonEmptyHoverText() |
boolean |
hasNonEmptyText() |
boolean |
isHovering(double x,
double y) |
boolean |
onLeftClick(double x,
double y)
No click actions by default
|
boolean |
onRightClick(double x,
double y)
No click actions by default
|
void |
playLeftClickSound() |
static Button |
radial(Circle circle,
double centerX,
double centerY,
java.util.function.Consumer<Button> settings) |
static Button[] |
radial(Circle circle,
double centerX,
double centerY,
int slices,
double startAngle,
java.util.function.BiConsumer<java.lang.Integer,Button> settings) |
static Button |
radial(Circle circle,
Vector2 center,
java.util.function.Consumer<Button> settings) |
static Button[] |
radial(Circle circle,
Vector2 center,
int slices,
double startAngle,
java.util.function.BiConsumer<java.lang.Integer,Button> settings) |
static WidgetGroup |
radialGroup(Circle circle,
double centerX,
double centerY,
int slices,
double startAngle,
java.util.function.BiConsumer<java.lang.Integer,Button> settings) |
static WidgetGroup |
radialGroup(Circle circle,
Vector2 center,
int slices,
java.util.function.BiConsumer<java.lang.Integer,Button> settings) |
static WidgetGroup |
radialGroup(Circle circle,
Vector2 center,
int slices,
double startAngle,
java.util.function.BiConsumer<java.lang.Integer,Button> settings) |
Button |
setClickFunc(java.util.function.Consumer<Button> onLeftClick) |
Button |
setContextFunc(java.util.function.Consumer<Button> onRightClick) |
Button |
setHoverLines(java.util.Collection<TextAPI<?>> text) |
void |
setHoverText(java.util.function.Consumer<TextWidget> text) |
void |
setText(java.lang.String literal) |
void |
setText(TextAPI<?> text) |
void |
setText(TextBuffer buffer) |
boolean |
shouldDrawHovered() |
java.lang.String |
toString() |
addWidget, addWidgets, addWidgets, applyScale, canBackspace, canType, checkEachClickable, checkEachHoverable, checkEachScrollable, checkEachSelectable, checkEachTickable, checkEachTypeable, checkEachWidget, copyGroup, draw, drawHoverable, drawSelectable, drawWidget, eachClickable, eachHoverable, eachScrollable, eachSelectable, eachTickable, eachTypeable, eachWidget, getElementsBottom, getElementsHeight, getElementsLeft, getElementsRight, getElementsTop, getElementsWidth, getHoveredElement, getRelativeTop, getSelectedElement, hasNonBlankText, isActivelyTicking, onBackspace, onCharTyped, onCopy, onCut, onKeyPressed, onPaste, onResolutionUpdated, onSelectAll, onTick, playRightClickSound, scrollDown, scrollUp, setWidgets, setWidgets, unapplyScalecanDraw, copyBasic, getBottom, getCenter, getCenter, getCenter, getLeft, getRight, getTop, getX, getY, isVisible, onScreenClosed, onScreenOpenedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcanCopy, canCut, canPaste, canSelectAllprotected final ShapeWidget shape
protected final TextWidget text
protected java.util.Collection<TextAPI<?>> hoverLines
protected Widget hover
protected java.util.function.Consumer<Button> clickFunc
protected java.util.function.Consumer<Button> contextFunc
public Button(@Nullable
@Nullable ShapeWidget shape,
@Nullable
@Nullable TextWidget text,
@Nullable
@Nullable Widget hover)
public static Button basic(double centerX, double centerY, TextAPI<?> text, TextAPI<?>... hoverLines)
public static Button basic(Vector2 center, TextAPI<?> text, java.util.Collection<TextAPI<?>> hoverLines)
public static Button basic(double centerX, double centerY, TextAPI<?> text, java.util.Collection<TextAPI<?>> hoverLines)
public static Button colored(ColorCache color, TextAPI<?> text, TextAPI<?>... hoverLines)
public static Button colored(ColorCache color, TextAPI<?> text, java.util.Collection<TextAPI<?>> hoverLines)
public static Button colored(Vector2 center, ColorCache color, TextAPI<?> text, TextAPI<?>... hoverLines)
public static Button colored(Vector2 center, ColorCache color, TextAPI<?> text, java.util.Collection<TextAPI<?>> hoverLines)
public static Button colored(double centerX, double centerY, ColorCache color, TextAPI<?> text, TextAPI<?>... hoverLines)
public static Button colored(double centerX, double centerY, ColorCache color, TextAPI<?> text, java.util.Collection<TextAPI<?>> hoverLines)
public static WidgetGroup radialGroup(Circle circle, Vector2 center, int slices, java.util.function.BiConsumer<java.lang.Integer,Button> settings)
public static WidgetGroup radialGroup(Circle circle, Vector2 center, int slices, double startAngle, java.util.function.BiConsumer<java.lang.Integer,Button> settings)
public static WidgetGroup radialGroup(Circle circle, double centerX, double centerY, int slices, double startAngle, java.util.function.BiConsumer<java.lang.Integer,Button> settings)
public static Button[] radial(Circle circle, Vector2 center, int slices, double startAngle, java.util.function.BiConsumer<java.lang.Integer,Button> settings)
public static Button[] radial(Circle circle, double centerX, double centerY, int slices, double startAngle, java.util.function.BiConsumer<java.lang.Integer,Button> settings)
public static Button radial(Circle circle, Vector2 center, java.util.function.Consumer<Button> settings)
public static Button radial(Circle circle, double centerX, double centerY, java.util.function.Consumer<Button> settings)
public void addHoverLine(TextAPI<?> text)
public void addHoverLines(TextAPI<?>... text)
public void addHoverLines(java.util.Collection<TextAPI<?>> text)
public Button copy()
copy in class WidgetGrouppublic void drawHovered(RenderContext ctx, Vector3 center, double mouseX, double mouseY)
drawHovered in interface HoverabledrawHovered in class WidgetGrouppublic void expandShapeHeightToText()
public void expandShapeToText()
public void expandShapeWidthToText()
public void fitShapeHeightToText()
public void fitShapeToText()
public void fitShapeWidthToText()
public double getHeight()
public java.util.Collection<TextAPI<?>> getHoverLines(double x, double y)
getHoverLines in interface HoverablegetHoverLines in class WidgetGrouppublic double getWidth()
public boolean hasNonBlankHoverText()
public boolean hasNonEmptyHoverText()
public boolean hasNonEmptyText()
hasNonEmptyText in class WidgetGrouppublic boolean isHovering(double x,
double y)
isHovering in interface HoverableisHovering in class WidgetGrouppublic boolean onLeftClick(double x,
double y)
onLeftClick in interface ClickableonLeftClick in class WidgetGrouppublic boolean onRightClick(double x,
double y)
onRightClick in interface ClickableonRightClick in class WidgetGrouppublic void playLeftClickSound()
playLeftClickSound in interface ClickableplayLeftClickSound in class WidgetGrouppublic void setHoverText(java.util.function.Consumer<TextWidget> text)
public void setText(java.lang.String literal)
public void setText(TextAPI<?> text)
public void setText(TextBuffer buffer)
public boolean shouldDrawHovered()
shouldDrawHovered in interface HoverableshouldDrawHovered in class WidgetGrouppublic java.lang.String toString()
toString in class java.lang.Object