tModLoader v2025.04
A mod to make and play Terraria mods
MapOverlayDrawContext Struct Reference

Classes

struct  DrawResult
 

Public Member Functions

 MapOverlayDrawContext (Vector2 mapPosition, Vector2 mapOffset, Rectangle? clippingRect, float mapScale, float drawScale)
 
DrawResult Draw (Texture2D texture, Vector2 position, Alignment alignment)
 
DrawResult Draw (Texture2D texture, Vector2 position, Color color, SpriteFrame frame, float scaleIfNotSelected, float scaleIfSelected, Alignment alignment)
 
DrawResult Draw (Texture2D texture, Vector2 position, Color color, SpriteFrame frame, float scaleIfNotSelected, float scaleIfSelected, Alignment alignment, SpriteEffects spriteEffects)
 Draws the texture (icon) over the map using the provided arguments. Check the returned DrawResult.IsMouseOver to check if the mouse is hovering over this icon. This is usually used to assign the text parameter of ModLoader.ModMapLayer.Draw(ref MapOverlayDrawContext, ref string) to the hover text of the icon. Note that the position argument expects tile coordinates expressed as a Vector2. Don't scale tile coordinates to world coordinates by multiplying by 16. If you are working with world coordinates you'll need to divide them by 16 to convert them to tile coordinates.
 
DrawResult Draw (Texture2D texture, Vector2 position, SpriteFrame frame, Alignment alignment)
 

Properties

readonly? Rectangle ClippingRectangle [get]
 The bounding box of the map in screen coordinates. This is used in vanilla to make icons disappear on the minimap when they go out of view. Note this only applies to the minimap and will be null when drawing the overlay and fullscreen maps.
 
readonly float DrawScale [get]
 A scale multiplier for the size of the icons on the map. This is typically passed as the 'scale' parameter of draw calls and accounts for things like Main.UIScale.
 
readonly Vector2 MapOffset [get]
 The position of the top left corner of the map in screen coordinates.
 
readonly Vector2 MapPosition [get]
 The tile coordinate that the top left corner of the map is showing. Note that this will always be Vector2.Zero when drawing the overlay and fullscreen maps.
 
readonly float MapScale [get]
 A scale multiplier for the size of the tiles on the map. See Main.mapMinimapScale, Main.mapFullscreenScale, and Main.mapOverlayScale.