Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DrawFilling()

void Terraria.GameContent.UI.Elements.UIGenProgressBar.DrawFilling ( SpriteBatch spritebatch,
Texture2D tex,
Texture2D texShadow,
Vector2 topLeft,
int completedWidth,
int totalWidth,
Color separator,
Color empty )
inlineprivate

Definition at line 81 of file UIGenProgressBar.cs.

82 {
83 if (completedWidth % 2 != 0)
84 {
85 completedWidth--;
86 }
87 Vector2 position = topLeft + completedWidth * Vector2.UnitX;
88 int num = completedWidth;
89 Rectangle value = tex.Frame();
90 while (num > 0)
91 {
92 if (value.Width > num)
93 {
94 value.X += value.Width - num;
95 value.Width = num;
96 }
97 spritebatch.Draw(tex, position, value, Color.White, 0f, new Vector2(value.Width, 0f), 1f, SpriteEffects.None, 0f);
98 position.X -= value.Width;
99 num -= value.Width;
100 }
101 if (texShadow != null)
102 {
103 spritebatch.Draw(texShadow, topLeft, new Rectangle(0, 0, completedWidth, texShadow.Height), Color.White);
104 }
105 spritebatch.Draw(TextureAssets.MagicPixel.Value, new Rectangle((int)topLeft.X + completedWidth, (int)topLeft.Y, totalWidth - completedWidth, tex.Height), new Rectangle(0, 0, 1, 1), empty);
106 spritebatch.Draw(TextureAssets.MagicPixel.Value, new Rectangle((int)topLeft.X + completedWidth - 2, (int)topLeft.Y, 2, tex.Height), new Rectangle(0, 0, 1, 1), separator);
107 }
void Draw(Texture2D texture, Vector2 position, Color color)

References Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Microsoft.Xna.Framework.Graphics.Texture2D.Height, Terraria.GameContent.TextureAssets.MagicPixel, Microsoft.Xna.Framework.Vector2.UnitX, Microsoft.Xna.Framework.Color.White, Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Vector2.Y.