States are pretty simple, it is how you take any data in and out of your widgets!
An Example of a state is
#[derive(State)] pub struct IntState(i32);
This will allow you to then insert the state into your app, and retrieve it from any function!
If you need an example of how to insert a state, all you have to do is:
App::new()?.states(IntState(0));
This will register your state, allowing you to use it in any widget!
Say you need to get/modify the int in IntState
IntState
It's pretty simple! Just make a widget that takes in that state!
fn widget(int_state: ResMut<IntState>) -> WidgetResult { int_state.0 += 1; Ok(()) }
See! Now you can modify any state within your widgets!
There was an error while loading. Please reload this page.