TheBevyFlock / bevy_quickstart

This template is a great way to get started on a new Bevy game—especially for a game jam!
https://the-bevy-flock.itch.io/bevy-quickstart
MIT License
153 stars 25 forks source link

Add OnPress to button widget #234

Closed Freyja-moth closed 1 month ago

Freyja-moth commented 1 month ago

Since each usage of the button widget has to add an on press afterwards it might be good to add an OnPress parameter to the method.

This would also allow to take advantage of impl traits to reduce the footprint of spawning buttons if From is implemented for OnPress.

janhohenheim commented 1 month ago

Good idea! We can even make the param a SystemId directly, that way OnPress can be a hidden implementation detail :)

benfrankel commented 1 month ago

It can be a closure that gets registered internally as well.

janhohenheim commented 1 month ago

@benfrankel that's fancy 👀

Freyja-moth commented 1 month ago

@benfrankel just to check, are you talking about passing in a closure to the buttons method or am I thinking of something completely different?

benfrankel commented 1 month ago

Yeah, exactly that.