pub struct Intent {
pub move_x: f32,
pub move_y: f32,
pub jump_pressed: bool,
pub jump_held: bool,
pub dash_pressed: bool,
pub grab: bool,
pub dive_pressed: bool,
pub sprint: bool,
pub super_dash: bool,
pub custom: u32,
pub custom_pressed: u32,
}Expand description
One step’s input. Edges (*_pressed) are true for exactly one step; the session
latches presses that land between steps so none get lost in slow motion.
Fields§
§move_x: f32Horizontal stick, -1 (left) to 1 (right).
move_y: f32Vertical stick, -1 (up) to 1 (down). Down fast-falls, aims dashes, climbs down and, with jump, drops through platforms.
jump_pressed: boolJump was pressed since the last step.
jump_held: boolJump is held.
dash_pressed: boolDash was pressed since the last step.
grab: boolGrab is held: hold on to walls.
dive_pressed: boolDive was pressed since the last step.
sprint: boolSprint is held: a higher top speed.
super_dash: boolSuper dash is held: charge it (on the ground or a wall); release to launch.
custom: u32Your game’s own buttons that are held (attack, interact, …), one bit each; the
movement ignores them. Bind keys to them with controls::Scheme::custom.
custom_pressed: u32Your game’s own buttons pressed since the last step, one bit each: latched by the
Platformer like the built-in presses, so none get lost between steps.
Implementations§
Trait Implementations§
impl Copy for Intent
impl StructuralPartialEq for Intent
Auto Trait Implementations§
impl Freeze for Intent
impl RefUnwindSafe for Intent
impl Send for Intent
impl Sync for Intent
impl Unpin for Intent
impl UnsafeUnpin for Intent
impl UnwindSafe for Intent
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.