Table of Contents

Class ProgressBar

Namespace
MLEM.Ui.Elements
Assembly
MLEM.Ui.dll

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 Anchor

The progress bar's anchor

size Vector2

The size of the progress bar

direction Direction2

The direction that the progress bar goes into

maxValue float

The progress bar's maximum value

currentValue float

The 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

Direction2

MaxValue

The maximum value that this progress bar should be able to have.

public float MaxValue

Field Value

float

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

StyleProp<NinePatch>

Texture

The background texture that this progress bar should render

public StyleProp<NinePatch> Texture

Field Value

StyleProp<NinePatch>

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

float

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 GameTime

The game's time

batch SpriteBatch

The sprite batch to use for drawing

alpha float

The alpha to draw this element and its children with

context SpriteBatchContext

The 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 UiStyle

The new style