EMI

EMI

1M Downloads

[Suggestion] Add ability for button widget to accept different textures

fzzyhmstrs opened this issue ยท 3 comments

commented

As it stands, trying to use WidgetHolder#addButton, you can only specify textures from somewhere on the EMI texture sheet. Issue is, I would like to add a button with tex not in that sheet. Suggestion is update how ButtonWidget works to allow for different texture identifiers, with the existing constructor thising the new one with the widget sheet tex. And then adding a new addButton override that lets the user put in their identifier to their 256x texture. More functionality to input different texture sizes could also be nice, but isn't as critical as just getting the ability to use a tex off a custom sheet.

For the button I want, I'm looking at a "cycling" button for use in Alloy Forgery's tier cycling they do in their current REI plugin
image

In place of REI's very generic ... texture
image

Now, I could use the blank button texture in the widgets sheet, but that wouldn't really convey useful information. I could also in theory layer a texture widget over the button widget, but I'm not sure the click would go through at that point, and that'salso pretty messy messy, especially since I would have to have custom logic for the "greyed out" icon.

With current offerings I will have to extend a ButtonWidget and override render.

commented

Really peculiar that it doesn't currently support this, I'll fix it next release

commented

After I made this suggestion, I did run into something that I would piggyback-suggest on top of this suggestion:

Widen (most) private fields in widgets to protected: A lot of the current widgets have all-private fields. This makes it hard to extend, say, a TextWidget for some little thing. You end up having to basically copy wholesale and then add your tweak to your whole new Widget (particularly if you are trying to tweak rendering, which uses a majority of those private fields).

Following widgets seem to be this way:

  • AnimatedTextureWidget
  • ButtonWidget
  • DrawableWidget
  • GeneratedSlotWidget
  • TextWidget

With only the SlotWidget and TextureWidget having the majority of their fields protected.

commented

Generally went forward with this and protected instead of privated a lot of fields where reasonable