pub struct PadReader { /* private fields */ }Expand description
A port reader that never hands a garbled packet to the game.
A poll that fails validation reports PadMode::Unknown with every
button released. Taken at face value, a held button would read as released
for that one frame and then as a fresh press on the next, so a held Select
or Cross fires twice. The reader returns the last clean state instead.
A clean report of an empty port is accepted as it is: unplugging a pad
does release its buttons.
Implementations§
Source§impl PadReader
impl PadReader
Sourcepub fn poll_on<T: Transport>(&mut self, port: &mut T) -> PadState
pub fn poll_on<T: Transport>(&mut self, port: &mut T) -> PadState
Poll the port once and return the latest clean state.
Sourcepub fn set_rumble(&mut self, rumble: Rumble)
pub fn set_rumble(&mut self, rumble: Rumble)
What the motors are asked to do on every poll from now on. Takes effect
on a DualShock in analog mode that has been through
enable_rumble_on.
Sourcepub fn enable_rumble_on<T: Transport>(&mut self, port: &mut T) -> bool
pub fn enable_rumble_on<T: Transport>(&mut self, port: &mut T) -> bool
Map the motors on this reader’s pad. See enable_rumble_on.
Sourcepub fn stop_motors_on<T: Transport>(&mut self, port: &mut T) -> PadState
pub fn stop_motors_on<T: Transport>(&mut self, port: &mut T) -> PadState
Stop both motors now: ask for none and poll once so the pad hears it. For a pause, a menu, an exit; an unplugged pad has nothing to stop.
Sourcepub fn poll(&mut self) -> PadState
👎Deprecated: use poll_on with the ControllerPort token
pub fn poll(&mut self) -> PadState
use poll_on with the ControllerPort token
Poll the port once and return the latest clean state.
Sourcepub fn accept(&mut self, state: PadState) -> PadState
pub fn accept(&mut self, state: PadState) -> PadState
Fold one poll result into the reader and return the latest clean
state. PadReader::poll_on calls this; it is public so a caller that
polls some other way gets the same rule.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PadReader
impl RefUnwindSafe for PadReader
impl Send for PadReader
impl Sync for PadReader
impl Unpin for PadReader
impl UnsafeUnpin for PadReader
impl UnwindSafe for PadReader
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)