Created
January 13, 2017 07:40
-
-
Save Trivaxy/24c189b0ea41a7b9dfbce87bbc79eb1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
{ | |
Main.hoverItemName = hoverText; | |
} | |
} | |
} | |
Texture2D duskButtonTexture = ModLoader.GetTexture("TrivaxysStuff/UI/DuskButton"); | |
UIHoverImageButton duskButton = new UIHoverImageButton(duskButtonTexture, "whatever string here"); | |
duskButton.Left.Set(8, 0f); | |
duskButton.Top.Set(8, 0f); | |
duskButton.Width.Set(22, 0f); | |
duskButton.Height.Set(22, 0f); | |
duskButton.OnClick += new MouseEvent(DuskButtonClicked); | |
MainPanel.Append(duskButton); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment