pub struct Joypad(/* private fields */);Expand description
Joypad input struct.
Joypad (Buttons and D-Pad key) can be checked by writing and reading the JOYP
register. (0xFF00) This struct makes it easy and safe.
The most recommended use is to receive key information on all keys at once using the Joypad::read()
function for once in each frame, and then check the key press using a method.
§Examples
let key = Joypad::read();
if key.a() {
println!("A pressed!");
}
if key.b() {
println!("B pressed!");
}Implementations§
Source§impl Joypad
impl Joypad
Sourcepub fn wait_until_press() -> Self
pub fn wait_until_press() -> Self
Waits until any key pressed.
Sourcepub fn wait_until_release()
pub fn wait_until_release()
Waits until all key released.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Joypad
impl RefUnwindSafe for Joypad
impl Send for Joypad
impl Sync for Joypad
impl Unpin for Joypad
impl UnwindSafe for Joypad
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