Even More Modifiers  1.0.0.0
A mod for rolling various bonus stats on items
GuiImageButton.cs
Go to the documentation of this file.
1 using Microsoft.Xna.Framework.Graphics;
2 using Terraria.GameContent.UI.Elements;
3 using Terraria.UI;
4 
5 namespace Loot.UI.Common.Controls.Button
6 {
7  internal class GuiImageButton : GuiButton
8  {
9  public UIImageButton Button { get; }
10 
11  public delegate void WhenClickedEvent(UIMouseEvent evt, UIElement listeningElement, UIImageButton btn);
12  public event WhenClickedEvent WhenClicked;
13 
14  internal GuiImageButton(ButtonType buttonType, Texture2D texture) : base(buttonType)
15  {
16  Button = new UIImageButton(texture);
17  Button.Width.Set(Width.Pixels, 0);
18  Button.Height.Set(Height.Pixels, 0);
19  Button.OnClick += (evt, element) => WhenClicked?.Invoke(evt, element, Button);
20  Frame.Append(Button);
21  }
22 
23  //protected override void DrawSelf(SpriteBatch spriteBatch)
24  //{
25  // base.DrawSelf(spriteBatch);
26  // //#if DEBUG
27  // // spriteBatch.Draw(
28  // // Main.magicPixel,
29  // // FrameBounds.ToRectangle(),
30  // // Color.Orange * 0.4f
31  // // );
32  // //#endif
33 
34  // //#if DEBUG
35  // // spriteBatch.Draw(
36  // // Main.magicPixel,
37  // // Button.GetOuterDimensions().ToRectangle(),
38  // // Color.Blue * 0.4f
39  // // );
40  // //#endif
41  //}
42  }
43 }