Closed jacobtread closed 11 months ago
Have you checked the editor with your changes? It is works as before?
I have not checked the editor i will have to get a game setup with one and will check that shortly
Ah the performance in the editor for the editor tabs is heavily degraded from the nested widgets and having to do has_descendant
to check descendants for hovering, looks like the custom widget approach you mentioned in #550 is definitely the better way to go.
Looks like i'll close this pull request as it doesn't seem like the viable approach unless you've got any ideas for making it work well?
After switching over to custom widgets they are definitely the way to go, closing this pr
Description
This feature adds a widget palette system onto widgets themselves which defines the brushes to use for the normal and hover states (On all widgets).
This enable things like the border color changing when a button is hovered as opposed to this only being supported by the background color for Decorator.
This should be backward compatible with the existing
with_background
/with_hover_brush
/with_normal_brush
system thats already in place as I modified those functions to update the palette instead.Usage
The
WidgetBuilder
structure now has apalette
field and awith_palette
function which takes in aWidgetPaletteBuilder
which you can use to define the colors for the different background and foreground states:There are also
with_background
andwith_foreground
functions on the palette builder to set both the hovered and normal colors (If a hovered color is not picked but a normal color is then when the palette is built it will use the normal color for the hovered color)In-game usage
Below is usage of this feature to make the border color of buttons transparent until they are hovered:
https://github.com/FyroxEngine/Fyrox/assets/33708767/a8d6a5d8-9774-4724-8e57-4532630ad1fd
Related Issue