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

◆ Draw() [3/3]

DrawResult Terraria.Map.MapOverlayDrawContext.Draw ( Texture2D texture,
Vector2 position,
SpriteFrame frame,
Alignment alignment )
inline

Definition at line 46 of file MapOverlayDrawContext.cs.

47 {
48 position = (position - _mapPosition) * _mapScale + _mapOffset;
49 if (_clippingRect.HasValue && !_clippingRect.Value.Contains(position.ToPoint()))
50 {
51 return DrawResult.Culled;
52 }
53 Rectangle sourceRectangle = frame.GetSourceRectangle(texture);
54 Vector2 vector = sourceRectangle.Size() * alignment.OffsetMultiplier;
55 Main.spriteBatch.Draw(texture, position, sourceRectangle, Color.White, 0f, vector, _drawScale, SpriteEffects.None, 0f);
56 position -= vector * _drawScale;
57 return new DrawResult(new Rectangle((int)position.X, (int)position.Y, (int)((float)texture.Width * _drawScale), (int)((float)texture.Height * _drawScale)).Contains(Main.MouseScreen.ToPoint()));
58 }
bool Contains(int x, int y)
Definition Rectangle.cs:92
Rectangle GetSourceRectangle(Texture2D texture)

References Terraria.Map.MapOverlayDrawContext._clippingRect, Terraria.Map.MapOverlayDrawContext._drawScale, Terraria.Map.MapOverlayDrawContext._mapOffset, Terraria.Map.MapOverlayDrawContext._mapPosition, Terraria.Map.MapOverlayDrawContext._mapScale, Microsoft.Xna.Framework.Rectangle.Contains(), Terraria.Map.MapOverlayDrawContext.DrawResult.Culled, Terraria.DataStructures.SpriteFrame.GetSourceRectangle(), Microsoft.Xna.Framework.Graphics.Texture2D.Height, Terraria.Main.MouseScreen, Terraria.UI.Alignment.OffsetMultiplier, Terraria.Main.spriteBatch, Microsoft.Xna.Framework.Color.White, Microsoft.Xna.Framework.Graphics.Texture2D.Width, Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Vector2.Y.