You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
No.
Describe the solution you'd like
Let us to make a button to use an image from code instead of setting it up in the theme json.
In the game I'm working, I'm using buttons to create a hotbar where the player can select spells. Each spell has its own icon, and there are some 50+ possible icons.
Setting each possible icon in the theme file and a ObjectID for each spell would be really annoying.
Using code to retrieve each image from the spell database would be much more useful.
Describe alternatives you've considered
As a workaround, I'm setting button.normal_image = my_surface, button.hovered_image = .... and running button.rebuild() and replacing _set_any_images_from_theme in a subclass.
This seems to work, but I'm not sure it would have undesired consequences.
I think implementing this, would open the way for a future implementation of icons for UISelectionList, since behind the scenes each item of a selection list is an UIButton.
The text was updated successfully, but these errors were encountered:
For me, the approach of adding a custom UIImage on top of an empty UIButton widget has worked without needing to specify anything in a theme file, at the expense of needing some additional manual layout work:
Is your feature request related to a problem? Please describe.
No.
Describe the solution you'd like
Let us to make a button to use an image from code instead of setting it up in the theme json.
In the game I'm working, I'm using buttons to create a hotbar where the player can select spells. Each spell has its own icon, and there are some 50+ possible icons.
Setting each possible icon in the theme file and a ObjectID for each spell would be really annoying.
Using code to retrieve each image from the spell database would be much more useful.
Describe alternatives you've considered
As a workaround, I'm setting
button.normal_image = my_surface, button.hovered_image = ....
and runningbutton.rebuild()
and replacing_set_any_images_from_theme
in a subclass.This seems to work, but I'm not sure it would have undesired consequences.
I think implementing this, would open the way for a future implementation of icons for UISelectionList, since behind the scenes each item of a selection list is an UIButton.
The text was updated successfully, but these errors were encountered: