Class ProgressBar
A progress bar element to use inside of a UiSystem. A progress bar is an element that fills up a bar based on a given CurrentValue percentage.
public class ProgressBar : Element, IGenericDataHolder
- Inheritance
-
ProgressBar
- Implements
- Inherited Members
- Extension Methods
Constructors
ProgressBar(Anchor, Vector2, Direction2, float, float)
Creates a new progress bar with the given settings
public ProgressBar(Anchor anchor, Vector2 size, Direction2 direction, float maxValue, float currentValue = 0)
Parameters
anchor
AnchorThe progress bar's anchor
size
Vector2The size of the progress bar
direction
Direction2The direction that the progress bar goes into
maxValue
floatThe progress bar's maximum value
currentValue
floatThe progress bar's current value
Exceptions
- NotSupportedException
If the provided direction is not IsAdjacent(Direction2)
Fields
Color
The color that this progress bar's Texture should render with
public StyleProp<Color> Color
Field Value
- StyleProp<Color>
Direction
The direction that this progress bar goes in. Note that only Adjacent directions are supported.
public Direction2 Direction
Field Value
MaxValue
The maximum value that this progress bar should be able to have.
public float MaxValue
Field Value
ProgressColor
The color that this progress bar's ProgressTexture is rendered with.
public StyleProp<Color> ProgressColor
Field Value
- StyleProp<Color>
ProgressPadding
The padding that this progress bar's ProgressTexture should have. The padding is the amount of pixels that the progress texture is away from the borders of the progress bar.
public StyleProp<Vector2> ProgressPadding
Field Value
- StyleProp<Vector2>
ProgressTexture
The texture that this progress bar's progress should render
public StyleProp<NinePatch> ProgressTexture
Field Value
Texture
The background texture that this progress bar should render
public StyleProp<NinePatch> Texture
Field Value
Properties
CurrentValue
The current value that this progress bar has. This value is always between 0 and MaxValue.
public float CurrentValue { get; set; }
Property Value
Methods
Draw(GameTime, SpriteBatch, float, SpriteBatchContext)
Draws this element and all of its children. Override this method to draw the content of custom elements.
Note that, when this is called, SpriteBatch.Begin
has already been called with custom Transform etc. applied.
public override void Draw(GameTime time, SpriteBatch batch, float alpha, SpriteBatchContext context)
Parameters
time
GameTimeThe game's time
batch
SpriteBatchThe sprite batch to use for drawing
alpha
floatThe alpha to draw this element and its children with
context
SpriteBatchContextThe sprite batch context to use for drawing
InitStyle(UiStyle)
Initializes this element's StyleProp<T> instances using the ui system's UiStyle.
protected override void InitStyle(UiStyle style)
Parameters
style
UiStyleThe new style