我刚开始学习 XNA,我想制作一个工具提示?我用谷歌搜索但没有找到任何答案。
提前致谢。
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);
}
您可以也应该使用Rectangle.Intersects来轻松查看鼠标是否在它上面。前任:
MouseRect = new Rectangle(ms.X,ms.Y,1,1)
if (MouseRect.Intersects(YourPoint.X,YourPoint.Y,WidthOfArea,HeightOfArea))