Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UISlicedImage.cs
Go to the documentation of this file.
4using Terraria.UI;
5
7
8public class UISlicedImage : UIElement
9{
11
12 private Color _color;
13
14 private int _leftSliceDepth;
15
16 private int _rightSliceDepth;
17
18 private int _topSliceDepth;
19
20 private int _bottomSliceDepth;
21
22 public Color Color
23 {
24 get
25 {
26 return _color;
27 }
28 set
29 {
30 _color = value;
31 }
32 }
33
35 {
36 _texture = texture;
37 Width.Set(_texture.Width(), 0f);
38 Height.Set(_texture.Height(), 0f);
39 }
40
41 public void SetImage(Asset<Texture2D> texture)
42 {
43 _texture = texture;
44 }
45
46 protected override void DrawSelf(SpriteBatch spriteBatch)
47 {
48 CalculatedStyle dimensions = GetDimensions();
49 Utils.DrawSplicedPanel(spriteBatch, _texture.Value, (int)dimensions.X, (int)dimensions.Y, (int)dimensions.Width, (int)dimensions.Height, _leftSliceDepth, _rightSliceDepth, _topSliceDepth, _bottomSliceDepth, _color);
50 }
51
52 public void SetSliceDepths(int top, int bottom, int left, int right)
53 {
54 _leftSliceDepth = left;
55 _rightSliceDepth = right;
56 _topSliceDepth = top;
57 _bottomSliceDepth = bottom;
58 }
59
60 public void SetSliceDepths(int fluff)
61 {
62 _leftSliceDepth = fluff;
63 _rightSliceDepth = fluff;
64 _topSliceDepth = fluff;
65 _bottomSliceDepth = fluff;
66 }
67}
override void DrawSelf(SpriteBatch spriteBatch)
void SetImage(Asset< Texture2D > texture)
void SetSliceDepths(int top, int bottom, int left, int right)
StyleDimension Height
Definition UIElement.cs:29
StyleDimension Width
Definition UIElement.cs:27
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
void Set(float pixels, float precent)