pub struct System { /* private fields */ }
Expand description
Contains the setup for a particular application.
Implementations§
Source§impl System
impl System
pub fn new() -> Self
Sourcepub fn add_users(&mut self, count: usize) -> &mut Self
pub fn add_users(&mut self, count: usize) -> &mut Self
Adds an amount of users to the system, connecting any unassigned devices to the new users as available.
Sourcepub fn add_action(&mut self, name: Id, action: Action) -> &mut Self
pub fn add_action(&mut self, name: Id, action: Action) -> &mut Self
Adds an action to the list of actions the system supports.
Sourcepub fn add_layout(&mut self, layout: LayoutId) -> &mut Self
pub fn add_layout(&mut self, layout: LayoutId) -> &mut Self
Adds a layout to the list of layouts the system supports.
Sourcepub fn add_action_set(&mut self, id: ActionSetId, set: ActionSet) -> &mut Self
pub fn add_action_set(&mut self, id: ActionSetId, set: ActionSet) -> &mut Self
Associates an action set
with an id
.
Sourcepub fn set_user_layout(
&mut self,
user_id: UserId,
layout: LayoutId,
) -> &mut Self
pub fn set_user_layout( &mut self, user_id: UserId, layout: LayoutId, ) -> &mut Self
Sets the layout of a user.
If not called, all user’s start with a None
layout (default layout).
Sourcepub fn mark_action_set_enabled(
&mut self,
user_id: UserId,
set_id: ActionSetId,
enabled: bool,
) -> &mut Self
pub fn mark_action_set_enabled( &mut self, user_id: UserId, set_id: ActionSetId, enabled: bool, ) -> &mut Self
Enables and disables a provided action set
for a given user.
When enabled, a user will receive input events for the actions in the action set
,
until the set is disabled (or until System::update
stops being called).
Sourcepub fn enable_action_set_for_all(&mut self, id: ActionSetId) -> &mut Self
pub fn enable_action_set_for_all(&mut self, id: ActionSetId) -> &mut Self
Enables an action set
for all existing users.
See System::mark_action_set_enabled
for further details.
Sourcepub fn send_event(&mut self, source: Source, event: Event)
pub fn send_event(&mut self, source: Source, event: Event)
Sends an input event to the system. Use with caution! Gamepad events are already handled/built-in, but Mouse and Keyboard events should come from the relevant feature/extension (like winit).
Sourcepub fn get_user_ids(&self) -> Vec<UserId> ⓘ
pub fn get_user_ids(&self) -> Vec<UserId> ⓘ
Returns a list of active user ids.