mirror of
https://github.com/OMGeeky/ItemChecklist.git
synced 2025-12-31 00:30:19 +01:00
0.1 initial release.
This commit is contained in:
43
UIHoverImageButton.cs
Normal file
43
UIHoverImageButton.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using ItemChecklist.UI;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Terraria;
|
||||
using Terraria.GameContent.UI.Elements;
|
||||
|
||||
namespace ItemChecklist
|
||||
{
|
||||
internal class UIHoverImageButton : UIImageButton
|
||||
{
|
||||
internal string hoverText;
|
||||
|
||||
public UIHoverImageButton(Texture2D texture, string hoverText) : base(texture)
|
||||
{
|
||||
this.hoverText = hoverText;
|
||||
}
|
||||
|
||||
protected override void DrawSelf(SpriteBatch spriteBatch)
|
||||
{
|
||||
base.DrawSelf(spriteBatch);
|
||||
if (IsMouseHovering)
|
||||
{
|
||||
ItemChecklistUI.hoverText = hoverText;
|
||||
//float x = Main.fontMouseText.MeasureString(hoverText).X;
|
||||
//Vector2 vector = new Vector2((float)Main.mouseX, (float)Main.mouseY) + new Vector2(16f, 0f);
|
||||
//if (vector.Y > (float)(Main.screenHeight - 30))
|
||||
//{
|
||||
// vector.Y = (float)(Main.screenHeight - 30);
|
||||
//}
|
||||
//if (vector.X > (float)(Parent.GetDimensions().Width + Parent.GetDimensions().X - x - 16))
|
||||
//{
|
||||
// vector.X = (float)(Parent.GetDimensions().Width + Parent.GetDimensions().X - x - 16);
|
||||
//}
|
||||
//Utils.DrawBorderStringFourWay(spriteBatch, Main.fontMouseText, hoverText, vector.X, vector.Y, new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), Color.Black, Vector2.Zero, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user