pub struct SharedState<S = ()> {Show 15 fields
pub mouse_info: MouseInfo,
pub mouse_pressed: MousePressedInfo,
pub mouse_events: MouseEvents,
pub target_fps: Option<f64>,
pub display_info: DisplayInfo,
pub pressed_keys: PressedKeys,
pub debounced_down_keys: HashSet<KeyCode>,
pub debug_info: DebugInfo,
pub debug_messages: SmallVec<[DebugMessage; 16]>,
pub extensions: AnyMap,
pub components_to_add: Vec<Box<dyn Component<S>>>,
pub fake_events_for_next_frame: Vec<Event>,
pub remove_components: HashSet<TypeId>,
pub whitelisted_components: Option<HashSet<TypeId>>,
pub custom: S,
}Expand description
The shared state that is passed to all components when they are executed.
§Custom state
teng supports custom state that can be shared between components.
This can be used to store game state, configuration, etc.
For often used state, SharedState allows embedding that state directly into the struct via the generic parameter.
For arbitrary data that may not be known statically, SharedState contains an AnyMap that can store arbitrary data.
See examples/ecs/ for an example of how to use embedded custom state.
Fields§
§mouse_info: MouseInfo§mouse_pressed: MousePressedInfo§mouse_events: MouseEvents§target_fps: Option<f64>§display_info: DisplayInfo§pressed_keys: PressedKeys§debounced_down_keys: HashSet<KeyCode>§debug_info: DebugInfo§debug_messages: SmallVec<[DebugMessage; 16]>§extensions: AnyMap§components_to_add: Vec<Box<dyn Component<S>>>§fake_events_for_next_frame: Vec<Event>§remove_components: HashSet<TypeId>§whitelisted_components: Option<HashSet<TypeId>>§custom: SAuto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more