Package fr.formiko.kokcinelo.tools
Class KProgressBar
java.lang.Object
com.badlogic.gdx.scenes.scene2d.Actor
fr.formiko.kokcinelo.tools.KProgressBar
- Direct Known Subclasses:
CreatureActionProgressBar
public class KProgressBar
extends com.badlogic.gdx.scenes.scene2d.Actor
A progress bar.
All colors can be null and will be tranculent.
Update value with
setProgress(float)
. Progress need to be in range 0.0f to 1.0f.- Since:
- 2.5
- Version:
- 2.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.badlogic.gdx.graphics.Color
protected com.badlogic.gdx.graphics.Color
protected com.badlogic.gdx.graphics.Color
protected float
-
Constructor Summary
ConstructorsConstructorDescriptionKProgressBar
(int width, int height, com.badlogic.gdx.graphics.Color backgroundFullColor, com.badlogic.gdx.graphics.Color backgroundEmptyColor, com.badlogic.gdx.graphics.Color borderColor) Main constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
draw
(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha) Draw the progress bar.float
void
setProgress
(float progress) 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, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setStage, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, sizeChanged, stageToLocalCoordinates, toBack, toFront, toString
-
Field Details
-
backgroundFullColor
@Null protected com.badlogic.gdx.graphics.Color backgroundFullColor -
backgroundEmptyColor
@Null protected com.badlogic.gdx.graphics.Color backgroundEmptyColor -
borderColor
@Null protected com.badlogic.gdx.graphics.Color borderColor -
progress
protected float progress
-
-
Constructor Details
-
KProgressBar
public KProgressBar(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) 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.backgroundEmptyColor
- Color of the empty part of the progress bar.borderColor
- Color of the border of the progress bar.
-
-
Method Details
-
getProgress
public float getProgress() -
setProgress
public void setProgress(float progress) -
draw
public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha) Draw the progress bar. Draw is done as filled rectangle for the full and empty sections, and empty rectangle for the border.- Overrides:
draw
in classcom.badlogic.gdx.scenes.scene2d.Actor
-