Bevy State UI
This library provides a simple and flexible way to render UI elements in Bevy based on a given application state. Using bevy_state_ui, you can bind UI elements to state properties and update them in real-time as the state changes.
Features
- State-Driven UI Rendering: Renders a UI based directly on state values, allowing for a clean separation between logic and presentation. This simplifies complex UI management by reducing the need for manual component manipulation.
- Automatic UI Element Registration: By implementing the Render trait on a custom state, UI elements are automatically registered and rendered based on the state.
- Interaction-Based State Updates: Provides easy handling of standard UI interactions (e.g., hover, press) by defining state updates within Bevy systems, making the UI more reactive to user input.
Installation
Add bevy_state_ui to your Cargo.toml dependencies:
[]
= "0.14.2"
= "0.3.0"
Example Usage
Here's how you can set up a simple UI with a button that changes color when hovered.
Example:
use *;
use *;