#[non_exhaustive]pub struct SeatInput {
pub pressed: Vec<ActionId>,
pub held: Vec<ActionId>,
pub released: Vec<ActionId>,
}Expand description
What one seat’s player did in one step: the actions pressed, held and
released, each by its ActionId and at most once in each list.
pressed: the actions that went down since the last step, in the order they went down.held: the actions down at the end of the frame the step ran in, in the game’s order. A tap (down and up again between two steps) is pressed without being held.released: the actions that came up, in the order they came up. A release is always in a step after its press’s, so a step that has an action both released and pressed let it go and pressed it again.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.pressed: Vec<ActionId>The actions that went down since the last step, in order.
held: Vec<ActionId>The actions down at the end of the frame the step ran in.
released: Vec<ActionId>The actions that came up since the last step, in order.
Implementations§
Source§impl SeatInput
impl SeatInput
Sourcepub fn new(
pressed: Vec<ActionId>,
held: Vec<ActionId>,
released: Vec<ActionId>,
) -> Self
pub fn new( pressed: Vec<ActionId>, held: Vec<ActionId>, released: Vec<ActionId>, ) -> Self
A seat’s input with these pressed, held and released actions.
Sourcepub fn is_pressed(&self, action: ActionId) -> bool
pub fn is_pressed(&self, action: ActionId) -> bool
Whether action went down since the last step.
Sourcepub fn is_released(&self, action: ActionId) -> bool
pub fn is_released(&self, action: ActionId) -> bool
Whether action came up since the last step.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SeatInput
impl<'de> Deserialize<'de> for SeatInput
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SeatInput
impl StructuralPartialEq for SeatInput
Auto Trait Implementations§
impl Freeze for SeatInput
impl RefUnwindSafe for SeatInput
impl Send for SeatInput
impl Sync for SeatInput
impl Unpin for SeatInput
impl UnsafeUnpin for SeatInput
impl UnwindSafe for SeatInput
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