Reputation: 301
i've just started to learn XNA and i want to make a tooltip? I've googled but not found any answer.
Thanks in advance.
Upvotes: 0
Views: 472
Reputation: 14153
MouseState ms = Mouse.GetState();
if (ms.X == YourPoint.X && ms.X == YourPoint.X)
{
SpriteBatch.DrawString(ToolTipFont, "A tooltip!", new Vector2(ms.X,ms.Y),Color.White);
}
You could and also should use Rectangle.Intersects for an easy way to see if the mouse is over it. Ex:
MouseRect = new Rectangle(ms.X,ms.Y,1,1)
if (MouseRect.Intersects(YourPoint.X,YourPoint.Y,WidthOfArea,HeightOfArea))
Upvotes: 1