Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UIProgressBar.cs
Go to the documentation of this file.
3using Terraria.UI;
4
6
7public class UIProgressBar : UIElement
8{
10 {
11 protected override void DrawSelf(SpriteBatch spriteBatch)
12 {
13 CalculatedStyle dimensions = GetDimensions();
14 spriteBatch.Draw(TextureAssets.MagicPixel.Value, new Vector2(dimensions.X, dimensions.Y), null, Color.Blue, 0f, Vector2.Zero, new Vector2(dimensions.Width, dimensions.Height / 1000f), SpriteEffects.None, 0f);
15 }
16 }
17
19
20 private float _visualProgress;
21
22 private float _targetProgress;
23
25 {
26 _progressBar.Height.Precent = 1f;
29 }
30
31 public void SetProgress(float value)
32 {
33 _targetProgress = value;
34 if (value < _visualProgress)
35 {
36 _visualProgress = value;
37 }
38 }
39
40 protected override void DrawSelf(SpriteBatch spriteBatch)
41 {
43 _progressBar.Width.Precent = _visualProgress;
45 }
46}
void Draw(Texture2D texture, Vector2 position, Color color)
static Asset< Texture2D > MagicPixel
override void DrawSelf(SpriteBatch spriteBatch)
void Append(UIElement element)
Definition UIElement.cs:166
virtual void Recalculate()
Definition UIElement.cs:281
CalculatedStyle GetDimensions()
Definition UIElement.cs:382