Class TProgressBarElement
java.lang.Object
io.github.thecsdev.tcdcommons.api.client.gui.TElement
io.github.thecsdev.tcdcommons.api.client.gui.other.TProgressBarElement
- All Implemented Interfaces:
TParentElement
,ITooltipProvider
,IEnableStateProvider
A
TElement
that renders a progress-bar on the screen.-
Nested Class Summary
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.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
-
Method Summary
Modifier and TypeMethodDescriptionfinal Direction2D
Returns theDirection2D
in which the progress-bar will visually progress.final float
Returns the 0-1 progress of this progress-bar.void
postRender
(TDrawContext pencil) void
render
(TDrawContext pencil) Renders this GUI element on the screen.protected final void
renderProgress
(TDrawContext pencil) Calculates the region in which the progress part of the progress-bar is to be rendered, and then callsrenderProgress(TDrawContext, int, int, int, int)
.protected void
renderProgress
(TDrawContext pencil, int x, int y, int width, int height) Renders this progress-bar's progress in a given region.final void
setDirection
(Direction2D direction) Sets theDirection2D
in which the progress-bar's visually progresses.final void
setProgress
(float progress) Sets the 0-1 progress of this progress-bar.Methods inherited from class io.github.thecsdev.tcdcommons.api.client.gui.TElement
canBeAddedTo, createContextMenu, getAlpha, getChildren, getEnabled, getHeight, getItemRenderer, getParent, getParentTElement, getParentTScreen, getTextRenderer, getTooltip, getTooltipPositioner, getWidth, getX, getY, getZIndex, getZOffset, input, isDragging, isEnabled, isEnabledAndVisible, isFocusable, isFocused, isFocusedOrHovered, isHoverable, isHovered, isVisible, move, moveChildren, next, 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
-
progress
protected float progress -
direction
-
-
Constructor Details
-
TProgressBarElement
public TProgressBarElement(int x, int y, int width, int height)
-
-
Method Details
-
getProgress
public final float getProgress()Returns the 0-1 progress of this progress-bar. -
setProgress
public final void setProgress(float progress) Sets the 0-1 progress of this progress-bar.- Parameters:
progress
- The [0 to 1] value of the progress.
-
getDirection
Returns theDirection2D
in which the progress-bar will visually progress. -
setDirection
Sets theDirection2D
in which the progress-bar's visually progresses.- Parameters:
direction
- TheDirection2D
.
-
render
Description copied from interface:TParentElement
Renders this GUI element on the screen.- Specified by:
render
in interfaceTParentElement
- Specified by:
render
in classTElement
- Parameters:
pencil
- TheTDrawContext
.
-
postRender
- Overrides:
postRender
in classTElement
-
renderProgress
Calculates the region in which the progress part of the progress-bar is to be rendered, and then callsrenderProgress(TDrawContext, int, int, int, int)
.- Parameters:
pencil
- TheTDrawContext
.
-
renderProgress
Renders this progress-bar's progress in a given region.- Parameters:
pencil
- TheTDrawContext
.
-