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

public class TProgressBarElement extends TElement
A TElement that renders a progress-bar on the screen.
  • Field Details

    • progress

      protected float progress
    • direction

      protected Direction2D 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

      public final Direction2D getDirection()
      Returns the Direction2D in which the progress-bar will visually progress.
    • setDirection

      public final void setDirection(Direction2D direction)
      Sets the Direction2D in which the progress-bar's visually progresses.
      Parameters:
      direction - The Direction2D.
    • render

      public void render(TDrawContext pencil)
      Description copied from interface: TParentElement
      Renders this GUI element on the screen.
      Specified by:
      render in interface TParentElement
      Specified by:
      render in class TElement
      Parameters:
      pencil - The TDrawContext.
    • postRender

      public void postRender(TDrawContext pencil)
      Overrides:
      postRender in class TElement
    • renderProgress

      protected final void renderProgress(TDrawContext pencil)
      Calculates the region in which the progress part of the progress-bar is to be rendered, and then calls renderProgress(TDrawContext, int, int, int, int).
      Parameters:
      pencil - The TDrawContext.
    • renderProgress

      protected void renderProgress(TDrawContext pencil, int x, int y, int width, int height)
      Renders this progress-bar's progress in a given region.
      Parameters:
      pencil - The TDrawContext.