pub trait UserInput:
Send
+ Sync
+ Debug {
// Required methods
fn kind(&self) -> InputControlKind;
fn decompose(&self) -> BasicInputs;
}
Expand description
A trait for defining the behavior expected from different user input sources.
Required Methods§
Sourcefn kind(&self) -> InputControlKind
fn kind(&self) -> InputControlKind
Defines the kind of behavior that the input should be.
Sourcefn decompose(&self) -> BasicInputs
fn decompose(&self) -> BasicInputs
Returns the set of primitive inputs that make up this input.
These inputs are used to detect clashes between different user inputs,
and are stored in a BasicInputs
for easy comparison.
For inputs that represent a simple, atomic control,
this method should always return a BasicInputs::Simple
that only contains the input itself.
Implementations on Foreign Types§
Source§impl UserInput for GamepadAxis
impl UserInput for GamepadAxis
fn kind(&self) -> InputControlKind
fn decompose(&self) -> BasicInputs
Source§impl UserInput for GamepadButton
impl UserInput for GamepadButton
Source§fn kind(&self) -> InputControlKind
fn kind(&self) -> InputControlKind
GamepadButton
acts as a button.
Source§fn decompose(&self) -> BasicInputs
fn decompose(&self) -> BasicInputs
Creates a BasicInputs
that only contains the GamepadButton
itself,
as it represents a simple physical button.
Source§impl UserInput for KeyCode
impl UserInput for KeyCode
Source§fn kind(&self) -> InputControlKind
fn kind(&self) -> InputControlKind
KeyCode
acts as a button.
Source§fn decompose(&self) -> BasicInputs
fn decompose(&self) -> BasicInputs
Returns a BasicInputs
that only contains the KeyCode
itself,
as it represents a simple physical button.
Source§impl UserInput for MouseButton
impl UserInput for MouseButton
Source§fn kind(&self) -> InputControlKind
fn kind(&self) -> InputControlKind
MouseButton
acts as a button.
Source§fn decompose(&self) -> BasicInputs
fn decompose(&self) -> BasicInputs
Returns a BasicInputs
that only contains the MouseButton
itself,
as it represents a simple physical button.
Implementors§
impl UserInput for UserInputWrapper
impl UserInput for ModifierKey
impl UserInput for AxislikeChord
impl UserInput for ButtonlikeChord
impl UserInput for DualAxislikeChord
impl UserInput for TripleAxislikeChord
impl UserInput for GamepadControlAxis
impl UserInput for GamepadControlDirection
impl UserInput for GamepadStick
impl UserInput for SpecificGamepadAxis
Unlike GamepadButton
, this struct represents a specific axis on a specific gamepad.
In the majority of cases, GamepadControlAxis
or GamepadStick
should be used instead.
impl UserInput for SpecificGamepadButton
Unlike GamepadButton
, this struct represents a specific button on a specific gamepad.
In the majority of cases, GamepadButton
should be used instead.