Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ DrawSelf() [1/2]

override void Terraria.GameContent.UI.Elements.UITextBox.DrawSelf ( SpriteBatch spriteBatch)
inlineprotected

Definition at line 74 of file UITextBox.cs.

75 {
76 if (HideSelf)
77 {
78 return;
79 }
80 _cursor = base.Text.Length;
81 base.DrawSelf(spriteBatch);
83 if ((_frameCount %= 40) <= 20 && ShowInputTicker)
84 {
85 CalculatedStyle innerDimensions = GetInnerDimensions();
86 Vector2 pos = innerDimensions.Position();
87 Vector2 vector = new Vector2((base.IsLarge ? FontAssets.DeathText.Value : FontAssets.MouseText.Value).MeasureString(base.Text.Substring(0, _cursor)).X, base.IsLarge ? 32f : 16f) * base.TextScale;
88 if (base.IsLarge)
89 {
90 pos.Y -= 8f * base.TextScale;
91 }
92 else
93 {
94 pos.Y -= 2f * base.TextScale;
95 }
96 pos.X += (innerDimensions.Width - base.TextSize.X) * TextHAlign + vector.X - (base.IsLarge ? 8f : 4f) * base.TextScale + 6f;
97 if (base.IsLarge)
98 {
99 Utils.DrawBorderStringBig(spriteBatch, "|", pos, base.TextColor, base.TextScale);
100 }
101 else
102 {
103 Utils.DrawBorderString(spriteBatch, "|", pos, base.TextColor, base.TextScale);
104 }
105 }
106 }

References Terraria.GameContent.UI.Elements.UITextBox._cursor, Terraria.GameContent.UI.Elements.UITextBox._frameCount, Terraria.GameContent.FontAssets.DeathText, Terraria.Utils.DrawBorderString(), Terraria.Utils.DrawBorderStringBig(), Terraria.GameContent.UI.Elements.UITextBox.HideSelf, Terraria.GameContent.FontAssets.MouseText, Terraria.UI.CalculatedStyle.Position(), Terraria.GameContent.UI.Elements.UITextBox.ShowInputTicker, Terraria.GameContent.UI.Elements.UITextPanel< string >.TextHAlign, Microsoft.Xna.Framework.Graphics.Vector2, Microsoft.Xna.Framework.Vector2.X, and System.X.