Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UIColoredSliderSimple.cs
Go to the documentation of this file.
3using Terraria.UI;
4
6
8{
9 public float FillPercent;
10
12
14
15 protected override void DrawSelf(SpriteBatch spriteBatch)
16 {
17 DrawValueBarDynamicWidth(spriteBatch);
18 }
19
21 {
22 Texture2D value = TextureAssets.ColorBar.Value;
23 Rectangle rectangle = GetDimensions().ToRectangle();
24 Rectangle rectangle2 = new Rectangle(5, 4, 4, 4);
25 Utils.DrawSplicedPanel(sb, value, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, rectangle2.X, rectangle2.Width, rectangle2.Y, rectangle2.Height, Color.White);
26 Rectangle rectangle3 = rectangle;
27 rectangle3.X += rectangle2.Left;
28 rectangle3.Width -= rectangle2.Right;
29 rectangle3.Y += rectangle2.Top;
30 rectangle3.Height -= rectangle2.Bottom;
31 Texture2D value2 = TextureAssets.MagicPixel.Value;
32 Rectangle value3 = new Rectangle(0, 0, 1, 1);
33 sb.Draw(value2, rectangle3, value3, EmptyColor);
34 Rectangle destinationRectangle = rectangle3;
35 destinationRectangle.Width = (int)((float)destinationRectangle.Width * FillPercent);
36 sb.Draw(value2, destinationRectangle, value3, FilledColor);
37 }
38}
void Draw(Texture2D texture, Vector2 position, Color color)
static Asset< Texture2D > MagicPixel
static Asset< Texture2D > ColorBar
static Microsoft.Xna.Framework.Color OurFavoriteColor
Definition Main.cs:902
CalculatedStyle GetDimensions()
Definition UIElement.cs:382
static void DrawSplicedPanel(SpriteBatch sb, Texture2D texture, int x, int y, int w, int h, int leftEnd, int rightEnd, int topEnd, int bottomEnd, Color c)
Definition Utils.cs:1964