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

◆ DrawSelf()

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

Reimplemented from Terraria.UI.UIElement.

Reimplemented in Terraria.GameContent.UI.Elements.UIImageWithBorder.

Definition at line 60 of file UIImage.cs.

61 {
62 CalculatedStyle dimensions = GetDimensions();
63 Texture2D texture2D = null;
64 if (_texture != null)
65 {
66 texture2D = _texture.Value;
67 }
68 if (_nonReloadingTexture != null)
69 {
70 texture2D = _nonReloadingTexture;
71 }
72 if (ScaleToFit)
73 {
74 spriteBatch.Draw(texture2D, dimensions.ToRectangle(), Color);
75 return;
76 }
77 Vector2 vector = texture2D.Size();
78 Vector2 vector2 = dimensions.Position() + vector * (1f - ImageScale) / 2f + vector * NormalizedOrigin;
80 {
81 vector2 = vector2.Floor();
82 }
83 spriteBatch.Draw(texture2D, vector2, null, Color, Rotation, vector * NormalizedOrigin, ImageScale, SpriteEffects.None, 0f);
84 }
void Draw(Texture2D texture, Vector2 position, Color color)
CalculatedStyle GetDimensions()
Definition UIElement.cs:382

References Terraria.GameContent.UI.Elements.UIImage._nonReloadingTexture, Terraria.GameContent.UI.Elements.UIImage._texture, 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.