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

◆ DrawSelf()

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

Reimplemented from Terraria.GameContent.UI.Elements.UIImage.

Definition at line 42 of file UIImageWithBorder.cs.

43 {
44 base.DrawSelf(spriteBatch);
45 CalculatedStyle dimensions = GetDimensions();
46 Texture2D texture2D = null;
47 if (_borderTexture != null)
48 {
49 texture2D = _borderTexture.Value;
50 }
52 {
54 }
55 if (ScaleToFit)
56 {
57 spriteBatch.Draw(texture2D, dimensions.ToRectangle(), Color);
58 return;
59 }
60 Vector2 vector = texture2D.Size();
61 Vector2 vector2 = dimensions.Position() + vector * (1f - ImageScale) / 2f + vector * NormalizedOrigin;
63 {
64 vector2 = vector2.Floor();
65 }
66 spriteBatch.Draw(texture2D, vector2, null, Color, Rotation, vector * NormalizedOrigin, ImageScale, SpriteEffects.None, 0f);
67 }
void Draw(Texture2D texture, Vector2 position, Color color)
CalculatedStyle GetDimensions()
Definition UIElement.cs:382

References Terraria.GameContent.UI.Elements.UIImageWithBorder._borderTexture, Terraria.GameContent.UI.Elements.UIImageWithBorder._nonReloadingBorderTexture, Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Terraria.UI.UIElement.GetDimensions(), Terraria.GameContent.UI.Elements.UIImage.ImageScale, Terraria.GameContent.UI.Elements.UIImage.NormalizedOrigin, Terraria.UI.CalculatedStyle.Position(), Terraria.GameContent.UI.Elements.UIImage.RemoveFloatingPointsFromDrawPosition, Terraria.GameContent.UI.Elements.UIImage.Rotation, Terraria.GameContent.UI.Elements.UIImage.ScaleToFit, Terraria.UI.CalculatedStyle.ToRectangle(), and ReLogic.Content.Asset< T >.Value.