Page 1 of 1

[0.16.2] GUI sprite-button not showing any sprites

Posted: Thu Dec 14, 2017 2:07 pm
by lovely_santa
Hello,

While updating my GUIs I came across this issue and no one in the discord server could find a solution, I even went as far as just implementing the example..
In the code below I add a sprite button to a frame to the top gui. As sprite path I just took the example as stated in the api of SpritePath:

Code: Select all

      local buttonDeaths = buttons.add{
        type = "sprite-button",
        name = "BZ_gui_buttonDeaths",
        sprite = "item/iron-plate"
      }
this code resulted in a functional button, but without a sprite (or just an empty one):
sprite-button.png
sprite-button.png (2.15 KiB) Viewed 1681 times
Am I just doiing it wrong?

EDIT: as 54758 states, it needs the style parameter, which is in conflict with the api of the LuaGuiElement saying it's optional. RSeding thinks its just broken, that it's not falling back to a default, so I left the bugreport in place...

Kind regards,
lovely_santa

Re: [0.16.2] GUI sprite-button not showing any sprites

Posted: Tue Dec 19, 2017 4:21 am
by Rseding91
Thanks for the report. Style is optional but all that means is "if you don't give it, it won't error" In the case of the sprite button no style means it's mostly useless.

I changed the sprite button so it defaults to a style that should work for most cases.

Re: [0.16.2] GUI sprite-button not showing any sprites

Posted: Tue Dec 19, 2017 4:40 pm
by kovarex
The solution also might be, that the sprite button is resized to the size of the sprite automatically unless it has specified size through script, in which case it would scale it.

Re: [0.16.2] GUI sprite-button not showing any sprites

Posted: Tue Dec 19, 2017 4:56 pm
by Klonan
kovarex wrote:The solution also might be, that the sprite button is resized to the size of the sprite automatically unless it has specified size through script, in which case it would scale it.
I believe this is intuitive behaviour, often have i had this problem where the custom 'sprite' widget already does this