This adds a simple button prompt plugin which spawns button prompts on UI buttons whose action can also be triggered by a physical button. More technically, it spawns button prompts as children of entities that have a UiAction<A>, where A is an Actionlike, and Res<InputMap<A>> exists. Currently this only works for single-keyboard input.
This also fixes an issue with the IconButtonPlugin. It despawned all of its children on change detection so it could respawn them, whether or not these children were icon button elements. Button prompts got caught in the crossfire. So, it has been changed to only despawn icon button elements change detection, and similarly the button prompt plugin only despawns the button prompt entity.
Tests have been added for the core functionality, change detection, and the bug fix described above.
Closes #114
This adds a simple button prompt plugin which spawns button prompts on UI buttons whose action can also be triggered by a physical button. More technically, it spawns button prompts as children of entities that have a
UiAction<A>
, whereA
is anActionlike
, andRes<InputMap<A>>
exists. Currently this only works for single-keyboard input.This also fixes an issue with the
IconButtonPlugin
. It despawned all of its children on change detection so it could respawn them, whether or not these children were icon button elements. Button prompts got caught in the crossfire. So, it has been changed to only despawn icon button elements change detection, and similarly the button prompt plugin only despawns the button prompt entity.Tests have been added for the core functionality, change detection, and the bug fix described above.