tModLoader v0.11.8.9
A mod to make and play Terraria mods
DrawableTooltipLine.cs
Go to the documentation of this file.
1using Microsoft.Xna.Framework;
2using ReLogic.Graphics;
3
4namespace Terraria.ModLoader
5{
6 // contains additional info for modders to use when using tooltip related draw hooks
7 // most stuff is readonly here or only has a public getter, because the related draw hooks are not meant for modifying most info (hence also new keywords to hide from TooltipLine)
8 // modders should use ModifyTooltips for modifying tooltips
9 // what is modifiable is certain draw related info such as the X and Y position
13 public sealed class DrawableTooltipLine : TooltipLine
14 {
18 public new readonly string text;
22 public readonly int index;
26 public new readonly bool isModifier;
30 public new readonly bool isModifierBad;
31
32 private int _originalX;
36 public int OriginalX {
37 get { return _originalX; }
38 internal set { X = _originalX = value; }
39 }
40
41 private int _originalY;
45 public int OriginalY {
46 get { return _originalY; }
47 internal set { Y = _originalY = value; }
48 }
52 public int X;
56 public int Y;
60 public Color color { get; internal set; }
64 public new Color? overrideColor { get; internal set; }
68 public new readonly bool oneDropLogo;
72 public DynamicSpriteFont font = Main.fontMouseText;
76 public float rotation = 0f;
80 public Vector2 origin = Vector2.Zero;
84 public Vector2 baseScale = Vector2.One;
85
86 public float maxWidth = -1;
87 public float spread = 2;
88
97 public DrawableTooltipLine(TooltipLine parent, int index, int x, int y, Color color) : base(parent.mod, parent.Name, parent.text) {
98 isModifier = parent.isModifier;
101 oneDropLogo = parent.oneDropLogo;
102 text = parent.text;
103
104 this.index = index;
105 OriginalX = x;
106 OriginalY = y;
107 this.color = color;
108 }
109 }
110}
This class serves as a way to store information about a line that will be drawn of tooltip for an ite...
int Y
The Y position where the tooltip would be drawn.
int OriginalX
The X position where the tooltip would be drawn that is not adjusted by mods.
int X
The X position where the tooltip would be drawn.
DrawableTooltipLine(TooltipLine parent, int index, int x, int y, Color color)
Creates a new DrawableTooltipLine object
Color color
The color the tooltip would be drawn in
new readonly bool isModifier
Whether or not this tooltip gives prefix information. This will make it so that the tooltip is colore...
new readonly string text
The text of this tooltip.
new readonly bool isModifierBad
If isModifier is true, this determines whether the tooltip is colored green or red.
readonly int index
The index of the tooltip in the array
Vector2 origin
The origin of this tooltip
int OriginalY
The Y position where the tooltip would be drawn that is not adjusted by mods.
float rotation
The rotation this tooltip would be drawn in
Vector2 baseScale
The baseScale of this tooltip. When drawing the One Drop logo the scale is calculated by (baseScale....
new readonly bool oneDropLogo
Whether the tooltip is a One Drop logo or not. If it is, the tooltip text will be empty.
new? Color overrideColor
If the tooltip line's color was overridden this will hold that color, it will be null otherwise
DynamicSpriteFont font
The font this tooltip would be drawn with
This class serves as a way to store information about a line of tooltip for an item....
Definition: TooltipLine.cs:9
bool isModifier
Whether or not this tooltip gives prefix information. This will make it so that the tooltip is colore...
Definition: TooltipLine.cs:25
bool isModifierBad
If isModifier is true, this determines whether the tooltip is colored green or red.
Definition: TooltipLine.cs:29
readonly string Name
The name of the tooltip, used to help you identify its function.
Definition: TooltipLine.cs:17
string text
The actual text that this tooltip displays.
Definition: TooltipLine.cs:21
readonly string mod
The name of the mod adding this tooltip line. This will be "Terraria" for all vanilla tooltip lines.
Definition: TooltipLine.cs:13
Color? overrideColor
This completely overrides the color the tooltip is drawn in. If it is set to null (the default value)...
Definition: TooltipLine.cs:33