Terraria ModLoader  0.11.7.5
A mod to make and play Terraria mods
DrawableTooltipLine.cs
Go to the documentation of this file.
1 using Microsoft.Xna.Framework;
2 using ReLogic.Graphics;
3 
4 namespace 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;
99  isModifierBad = parent.isModifierBad;
100  overrideColor = parent.overrideColor;
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 }
new readonly bool isModifierBad
If isModifier is true, this determines whether the tooltip is colored green or red.
This class serves as a way to store information about a line of tooltip for an item. You will create and manipulate objects of this class if you use the ModifyTooltips hook.
Definition: TooltipLine.cs:8
DrawableTooltipLine(TooltipLine parent, int index, int x, int y, Color color)
Creates a new DrawableTooltipLine object
int Y
The Y position where the tooltip would be drawn.
string text
The actual text that this tooltip displays.
Definition: TooltipLine.cs:21
new readonly string text
The text of this tooltip.
new readonly bool isModifier
Whether or not this tooltip gives prefix information. This will make it so that the tooltip is colore...
bool isModifier
Whether or not this tooltip gives prefix information. This will make it so that the tooltip is colore...
Definition: TooltipLine.cs:25
new readonly bool oneDropLogo
Whether the tooltip is a One Drop logo or not. If it is, the tooltip text will be empty...
bool isModifierBad
If isModifier is true, this determines whether the tooltip is colored green or red.
Definition: TooltipLine.cs:29
int X
The X position where the tooltip would be drawn.
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
readonly int index
The index of the tooltip in the array
This class serves as a way to store information about a line that will be drawn of tooltip for an ite...