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

◆ DrawSelf()

override void Terraria.GameContent.UI.Elements.UIIconTextButton.DrawSelf ( SpriteBatch spriteBatch)
inlineprotectedvirtual

Reimplemented from Terraria.UI.UIElement.

Definition at line 78 of file UIIconTextButton.cs.

79 {
80 if (_hovered)
81 {
82 if (!_soundedHover)
83 {
85 }
86 _soundedHover = true;
87 }
88 else
89 {
90 _soundedHover = false;
91 }
92 CalculatedStyle dimensions = GetDimensions();
93 Color color = _color;
94 float opacity = _opacity;
95 Utils.DrawSplicedPanel(spriteBatch, _BasePanelTexture.Value, (int)dimensions.X, (int)dimensions.Y, (int)dimensions.Width, (int)dimensions.Height, 10, 10, 10, 10, Color.Lerp(Color.Black, color, FadeFromBlack) * opacity);
96 if (_iconTexture != null)
97 {
98 Color color2 = Color.Lerp(color, Color.White, _whiteLerp) * opacity;
99 spriteBatch.Draw(_iconTexture.Value, new Vector2(dimensions.X + dimensions.Width - (float)_iconTexture.Width() - 5f, dimensions.Center().Y - (float)(_iconTexture.Height() / 2)), color2);
100 }
101 }
void Draw(Texture2D texture, Vector2 position, Color color)
static void PlaySound(int type, Vector2 position, int style=1)
CalculatedStyle GetDimensions()
Definition UIElement.cs:382
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491

References Terraria.GameContent.UI.Elements.UIIconTextButton._BasePanelTexture, Terraria.GameContent.UI.Elements.UIIconTextButton._color, Terraria.GameContent.UI.Elements.UIIconTextButton._hovered, Terraria.GameContent.UI.Elements.UIIconTextButton._iconTexture, Terraria.GameContent.UI.Elements.UIIconTextButton._opacity, Terraria.GameContent.UI.Elements.UIIconTextButton._soundedHover, Terraria.GameContent.UI.Elements.UIIconTextButton._whiteLerp, Microsoft.Xna.Framework.Color.Black, Terraria.UI.CalculatedStyle.Center(), Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Terraria.Utils.DrawSplicedPanel(), Terraria.GameContent.UI.Elements.UIIconTextButton.FadeFromBlack, Terraria.UI.UIElement.GetDimensions(), Terraria.UI.CalculatedStyle.Height, Microsoft.Xna.Framework.Color.Lerp(), Terraria.Audio.SoundEngine.PlaySound(), ReLogic.Content.Asset< T >.Value, Microsoft.Xna.Framework.Color.White, Terraria.UI.CalculatedStyle.Width, Terraria.UI.CalculatedStyle.X, Microsoft.Xna.Framework.Vector2.Y, and Terraria.UI.CalculatedStyle.Y.