Example #1
0
 private void DrawTooltip()
 {
     if (TooltipText != null && !TooltipText.IsEmpty())
     {
         SpriteReference ui_tooltip   = SpriteLoader.Instance.AddSprite("content/ui_box");
         int             tooltipWidth = (int)TooltipText.GetContentWidth();
         int             screenWidth  = Viewport.Width - 8 - InputState.MouseX + 4;
         bool            invert       = false;
         if (tooltipWidth > screenWidth)
         {
             screenWidth = Viewport.Width - screenWidth;
             invert      = true;
         }
         int tooltipHeight = (int)TooltipText.GetContentHeight();
         int tooltipX      = InputState.MouseX + 4;
         int tooltipY      = Math.Max(0, InputState.MouseY - 4 - tooltipHeight);
         if (invert)
         {
             tooltipX -= tooltipWidth;
         }
         DrawUI(ui_tooltip, new Rectangle(tooltipX - 2, tooltipY - 2, tooltipWidth + 4, tooltipHeight + 4), Color.White);
         TooltipText.Draw(new Vector2(tooltipX, tooltipY), FontRenderer);
     }
 }
Example #2
0
 private Point GetSize()
 {
     return(new Point((int)Content.GetContentWidth(), (int)Content.GetContentHeight()));
 }