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

◆ DrawSelf()

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

Reimplemented from Terraria.UI.UIElement.

Definition at line 52 of file EmoteButton.cs.

53 {
54 CalculatedStyle dimensions = GetDimensions();
55 Vector2 vector = dimensions.Position() + new Vector2(dimensions.Width, dimensions.Height) / 2f;
56 Rectangle frame = GetFrame();
57 Rectangle value = frame;
58 value.X = _texture.Width() / 8;
59 value.Y = 0;
60 Vector2 origin = frame.Size() / 2f;
61 Color white = Color.White;
62 Color color = Color.Black;
63 if (_hovered)
64 {
65 color = Main.OurFavoriteColor;
66 }
67 spriteBatch.Draw(_texture.Value, vector, value, white, 0f, origin, 1f, SpriteEffects.None, 0f);
68 spriteBatch.Draw(_texture.Value, vector, frame, white, 0f, origin, 1f, SpriteEffects.None, 0f);
69 spriteBatch.Draw(_textureBorder.Value, vector - Vector2.One * 2f, null, color, 0f, origin, 1f, SpriteEffects.None, 0f);
70 if (_hovered)
71 {
72 string name = EmoteID.Search.GetName(_emoteIndex);
73 string cursorText = "/" + Language.GetTextValue("EmojiName." + name);
74 Main.instance.MouseText(cursorText, 0, 0);
75 }
76 }
void Draw(Texture2D texture, Vector2 position, Color color)
static string GetTextValue(string key)
Definition Language.cs:15
CalculatedStyle GetDimensions()
Definition UIElement.cs:382

References Terraria.GameContent.UI.Elements.EmoteButton._emoteIndex, Terraria.GameContent.UI.Elements.EmoteButton._hovered, Terraria.GameContent.UI.Elements.EmoteButton._texture, Terraria.GameContent.UI.Elements.EmoteButton._textureBorder, Microsoft.Xna.Framework.Color.Black, Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Terraria.UI.UIElement.GetDimensions(), Terraria.GameContent.UI.Elements.EmoteButton.GetFrame(), Terraria.Localization.Language.GetTextValue(), Terraria.UI.CalculatedStyle.Height, Terraria.Main.instance, Microsoft.Xna.Framework.Vector2.One, Terraria.Main.OurFavoriteColor, Terraria.UI.CalculatedStyle.Position(), Terraria.GameContent.UI.EmoteID.Search, ReLogic.Content.Asset< T >.Value, Microsoft.Xna.Framework.Graphics.Vector2, Microsoft.Xna.Framework.Color.White, and Terraria.UI.CalculatedStyle.Width.