Struct input_actions::System
source · [−]pub struct System { /* private fields */ }
Expand description
Contains the setup for a particular application.
Implementations
sourceimpl 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.
Auto Trait Implementations
impl !RefUnwindSafe for System
impl !Send for System
impl !Sync for System
impl Unpin for System
impl !UnwindSafe for System
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more