Class CreatureActionProgressBar

java.lang.Object
com.badlogic.gdx.scenes.scene2d.Actor
fr.formiko.kokcinelo.tools.KProgressBar
fr.formiko.kokcinelo.view.CreatureActionProgressBar

public class CreatureActionProgressBar extends KProgressBar
A custom progress bar for creature action. The only changes are the addition of a label to display the action name and the change of the background color when the action is ready. Color change wen progress bar is full allow to see clearly when the action is ready.
Since:
2.5
Version:
2.5
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final com.badlogic.gdx.scenes.scene2d.ui.Label
     
    protected com.badlogic.gdx.graphics.Color
     
    protected com.badlogic.gdx.graphics.Color
     

    Fields inherited from class fr.formiko.kokcinelo.tools.KProgressBar

    backgroundEmptyColor, backgroundFullColor, borderColor, progress
  • Constructor Summary

    Constructors
    Constructor
    Description
    CreatureActionProgressBar(int width, int height, com.badlogic.gdx.graphics.Color backgroundFullColor, com.badlogic.gdx.graphics.Color backgroundEmptyColor, com.badlogic.gdx.graphics.Color borderColor, com.badlogic.gdx.graphics.Color actionReadyColor, String actionName, com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
    Main constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
    Draw the progress bar and the action name label.
    void
    setBounds(float x, float y, float width, float height)
    Setter that also apply to actionNameLabel.
    void
    setPosition(float x, float y)
    Setter that also apply to actionNameLabel.
    void
    setProgress(float progress)
    Set progress & change background color if progress is 1.
    void
    setSize(float width, float height)
    Setter that also apply to actionNameLabel.

    Methods inherited from class fr.formiko.kokcinelo.tools.KProgressBar

    getProgress

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor

    act, addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, hit, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, scaleChanged, screenToLocalCoordinates, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setStage, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, sizeChanged, stageToLocalCoordinates, toBack, toFront, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • actionReadyColor

      @Null protected com.badlogic.gdx.graphics.Color actionReadyColor
    • actionNotReadyColor

      @Null protected com.badlogic.gdx.graphics.Color actionNotReadyColor
    • actionNameLabel

      protected final com.badlogic.gdx.scenes.scene2d.ui.Label actionNameLabel
  • Constructor Details

    • CreatureActionProgressBar

      public CreatureActionProgressBar(int width, int height, @Null com.badlogic.gdx.graphics.Color backgroundFullColor, @Null com.badlogic.gdx.graphics.Color backgroundEmptyColor, @Null com.badlogic.gdx.graphics.Color borderColor, @Null com.badlogic.gdx.graphics.Color actionReadyColor, String actionName, com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
      Main constructor.
      Parameters:
      width - Width of the progress bar in pixel.
      height - Height of the progress bar in pixel. If -1, height will be 1/10 of width.
      backgroundFullColor - Color of the full part of the progress bar when action is not ready.
      backgroundEmptyColor - Color of the empty part of the progress bar.
      borderColor - Color of the border of the progress bar.
      actionReadyColor - Color of the full part of the progress bar when action is ready.
      actionName - Name of the action to display.
      skin - Skin to use for the label.
  • Method Details

    • setProgress

      public void setProgress(float progress)
      Set progress & change background color if progress is 1.
      Overrides:
      setProgress in class KProgressBar
    • draw

      public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
      Draw the progress bar and the action name label.
      Overrides:
      draw in class KProgressBar
    • setSize

      public void setSize(float width, float height)
      Setter that also apply to actionNameLabel.
      Overrides:
      setSize in class com.badlogic.gdx.scenes.scene2d.Actor
    • setPosition

      public void setPosition(float x, float y)
      Setter that also apply to actionNameLabel.
      Overrides:
      setPosition in class com.badlogic.gdx.scenes.scene2d.Actor
    • setBounds

      public void setBounds(float x, float y, float width, float height)
      Setter that also apply to actionNameLabel.
      Overrides:
      setBounds in class com.badlogic.gdx.scenes.scene2d.Actor