Class TSliderWidget
java.lang.Object
io.github.thecsdev.tcdcommons.api.client.gui.TElement
io.github.thecsdev.tcdcommons.api.client.gui.widget.TClickableWidget
io.github.thecsdev.tcdcommons.api.client.gui.widget.TButtonWidget
io.github.thecsdev.tcdcommons.api.client.gui.widget.TSliderWidget
- All Implemented Interfaces:
TParentElement
,ITooltipProvider
,IEnableStateProvider
,IEnableStateProviderSetter
,ITextProvider
,ITextProviderSetter
- Direct Known Subclasses:
TScrollBarWidget
-
Nested Class Summary
Nested classes/interfaces inherited from class io.github.thecsdev.tcdcommons.api.client.gui.widget.TClickableWidget
TClickableWidget.TClickableWidgetEvent_Clicked
Nested classes/interfaces inherited from class io.github.thecsdev.tcdcommons.api.client.gui.TElement
TElement.TElementEvent_ChildAR, TElement.TElementEvent_ContextMenu, TElement.TElementEvent_Moved, TElement.TElementEvent_ParentChanged, TElement.TElementEvent_Resized
-
Field Summary
Fields inherited from class io.github.thecsdev.tcdcommons.api.client.gui.widget.TButtonWidget
icon, iconColor, onClick, text
Fields inherited from class io.github.thecsdev.tcdcommons.api.client.gui.widget.TClickableWidget
BUTTON_TEXTURE_SLICE_SIZE, BUTTON_TEXTURES, eClicked, enabled, T_WIDGETS_TEXTURE
Fields inherited from class io.github.thecsdev.tcdcommons.api.client.gui.TElement
alpha, eChildAdded, eChildRemoved, eContextMenu, eMoved, eParentChanged, eResized, height, SP_ALL, SP_INVOKE_EVENT, SP_MOVE_CHILDREN, SP_RELATIVE, SP_UPDATE_TOPMOST, SS_ALL, SS_INVOKE_EVENT, SS_UPDATE_TOPMOST, tooltip, tooltipPositioner, width, x, y, zOffset
Fields inherited from interface io.github.thecsdev.tcdcommons.api.client.gui.TParentElement
MAX_CHILD_NESTING_DEPTH
-
Constructor Summary
ConstructorDescriptionTSliderWidget
(int x, int y, int width, int height, double value) TSliderWidget
(int x, int y, int width, int height, net.minecraft.text.Text text, double value) -
Method Summary
Modifier and TypeMethodDescriptionfinal int
final Direction2D
final double
getValue()
boolean
input
(TInputContext inputContext) An input handler that handles inputs on theTInputContext.InputDiscoveryPhase.MAIN
input phase.void
render
(TDrawContext pencil) Renders this GUI element on the screen.final void
renderSliderKnob
(TDrawContext pencil) Draws the dragabble little knob that is used as the visual slider value indicator.void
renderSliderKnob
(TDrawContext pencil, int knobX, int knobY, int knobWidth, int knobHeight) Draws the dragabble little knob that is used as the visual slider value indicator.void
renderSliderProgressBar
(TDrawContext pencil) Draws a progress bar that is used as the visual slider value indicator.
Another primary use for this is this being thegetSliderDirection()
indicator.void
setKnobSize
(int size) void
setSliderDirection
(Direction2D direction) final void
setValue
(double value) void
setValue
(double value, boolean applyValue) final void
setValueFromMouse
(double mouseX, double mouseY) Methods inherited from class io.github.thecsdev.tcdcommons.api.client.gui.widget.TButtonWidget
getIcon, getIconColor, getOnClick, getText, onClick, renderBackground, renderIcon, setIcon, setIconColor, setIconColor, setOnClick, setText
Methods inherited from class io.github.thecsdev.tcdcommons.api.client.gui.widget.TClickableWidget
click, getEnabled, isFocusable, setEnabled
Methods inherited from class io.github.thecsdev.tcdcommons.api.client.gui.TElement
canBeAddedTo, createContextMenu, getAlpha, getChildren, getHeight, getItemRenderer, getParent, getParentTElement, getParentTScreen, getTextRenderer, getTooltip, getTooltipPositioner, getWidth, getX, getY, getZIndex, getZOffset, isDragging, isEnabled, isEnabledAndVisible, isFocused, isFocusedOrHovered, isHoverable, isHovered, isVisible, move, moveChildren, next, postRender, previous, setAlpha, setPosition, setPosition, setSize, setSize, setTooltip, setZOffset, tick, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.github.thecsdev.tcdcommons.api.client.gui.TParentElement
addChild, addChild, clearChildren, findChild, findLastChild, findParent, findParentTElement, forEachChild, getEndX, getEndY, input, removeChild, removeChild
-
Field Details
-
sliderDirection
-
value
protected double value -
knobSize
protected int knobSize
-
-
Constructor Details
-
TSliderWidget
public TSliderWidget(int x, int y, int width, int height, double value) -
TSliderWidget
public TSliderWidget(int x, int y, int width, int height, net.minecraft.text.Text text, double value)
-
-
Method Details
-
getSliderDirection
-
setSliderDirection
-
getValue
public final double getValue() -
setValue
public final void setValue(double value) -
setValue
public void setValue(double value, boolean applyValue) -
setValueFromMouse
public final void setValueFromMouse(double mouseX, double mouseY) -
getKnobSize
public final int getKnobSize() -
setKnobSize
public void setKnobSize(int size) -
render
Description copied from interface:TParentElement
Renders this GUI element on the screen.- Specified by:
render
in interfaceTParentElement
- Overrides:
render
in classTButtonWidget
- Parameters:
pencil
- TheTDrawContext
.
-
renderSliderProgressBar
Draws a progress bar that is used as the visual slider value indicator.
Another primary use for this is this being thegetSliderDirection()
indicator.- Parameters:
pencil
- TheTDrawContext
.
-
renderSliderKnob
Draws the dragabble little knob that is used as the visual slider value indicator.- Parameters:
pencil
- TheTDrawContext
.
-
renderSliderKnob
public void renderSliderKnob(TDrawContext pencil, int knobX, int knobY, int knobWidth, int knobHeight) Draws the dragabble little knob that is used as the visual slider value indicator.- Parameters:
pencil
- TheTDrawContext
.knobX
- The knob X position.knobY
- The knob Y position.knobWidth
- The knob size width.knobHeight
- The knob size height.
-
input
Description copied from interface:TParentElement
An input handler that handles inputs on theTInputContext.InputDiscoveryPhase.MAIN
input phase.- Specified by:
input
in interfaceTParentElement
- Overrides:
input
in classTClickableWidget
- Parameters:
inputContext
- TheTInputContext
containing information about a given input.- See Also:
-