Page 1 of 1

[2.0.12] Caption of sprite-button behind sprite

Posted: Tue Oct 29, 2024 8:12 am
by r3nt5ch3r
Creating a sprite-button with a caption renders the caption behind the sprite.
Expectation is that the caption is always on top. This was the case for 1.1.110.

1.1.110:
/c game.player.gui.screen.add({
type = "sprite-button",
caption = "AAA"
}).sprite = "utility/close_white"
grafik.png
grafik.png (8 KiB) Viewed 883 times

2.0.12:
/c game.player.gui.screen.add({
type = "sprite-button",
caption = "AAA"
}).sprite = "utility/close"
grafik.png
grafik.png (7.36 KiB) Viewed 883 times

Re: [2.0.12] Caption of sprite-button behind sprite

Posted: Tue Oct 29, 2024 11:41 pm
by Wichu
yes, can confirm that behavior has changed, it worked fine in 1.1 but in 2.0 (2.0.12 tested) it seems to be behind the sprite:
10-30-2024, 00-40-55.png
10-30-2024, 00-40-55.png (9.65 KiB) Viewed 838 times
<- top-left button had the sprite removed to show the text again

Re: [2.0.12] Caption of sprite-button behind sprite

Posted: Wed Oct 30, 2024 12:03 am
by Rseding91
Thanks for the report. I've fixed this for the next release however the way it's fixed might cause other issues. The issue was: in 2.0 the custom sprite button widget got merged with a bunch of other "draws sprite" widgets and none of them (that I can tell) cared about the caption part and so drew it first (and it would always be empty for everything else).

I've changed it so the caption part draws last, but this might have unforeseen consequences in other parts of the GUI. At least, I couldn't find any issues. But this might come back to bite me in the next release - lets hope not.

Re: [2.0.12] Caption of sprite-button behind sprite

Posted: Wed Oct 30, 2024 12:18 am
by Wichu
nice, thank you for the quick work. Will check as soon as it's available! Thanks again! And I'm sure it will not have any side-effects whatsoever :-)

Works perfectly, from what I can see so far!
10-30-2024, 20-26-39.png
10-30-2024, 20-26-39.png (10.33 KiB) Viewed 718 times