[−][src]Struct gba_hal::data::KeyInput
This is the GBA's native key reading value.
The term "native" here means "low-active". In other words, false
==
"pressed", and true
is "released".
You probably actually want to have "normal" style key data, where false
== "released" and true
== "pressed". To get this you must XOR the lower
10 bits of the inner value:
let high_active_keys_value = key_input.0 ^ 0b11_1111_1111;
That's not provided by this crate because this crate sticks to minimal declarations. You can of course use the gba crate for this and other helpful higher level abstractions.
The bits are as follows:
- 0: a
- 1: b
- 2: select
- 3: start
- 4: right
- 5: left
- 6: up
- 7: down
- 8: r
- 9: l
Methods
impl KeyInput
[src]
impl KeyInput
[src]
pub const A_RELEASED_BIT: u16
[src]
pub const fn a_released(self) -> bool
[src]
pub const fn with_a_released(self, bit: bool) -> Self
[src]
pub const B_RELEASED_BIT: u16
[src]
pub const fn b_released(self) -> bool
[src]
pub const fn with_b_released(self, bit: bool) -> Self
[src]
pub const SELECT_RELEASED_BIT: u16
[src]
pub const fn select_released(self) -> bool
[src]
pub const fn with_select_released(self, bit: bool) -> Self
[src]
pub const START_RELEASED_BIT: u16
[src]
pub const fn start_released(self) -> bool
[src]
pub const fn with_start_released(self, bit: bool) -> Self
[src]
pub const RIGHT_RELEASED_BIT: u16
[src]
pub const fn right_released(self) -> bool
[src]
pub const fn with_right_released(self, bit: bool) -> Self
[src]
pub const LEFT_RELEASED_BIT: u16
[src]
pub const fn left_released(self) -> bool
[src]
pub const fn with_left_released(self, bit: bool) -> Self
[src]
pub const UP_RELEASED_BIT: u16
[src]
pub const fn up_released(self) -> bool
[src]
pub const fn with_up_released(self, bit: bool) -> Self
[src]
pub const DOWN_RELEASED_BIT: u16
[src]
pub const fn down_released(self) -> bool
[src]
pub const fn with_down_released(self, bit: bool) -> Self
[src]
pub const R_RELEASED_BIT: u16
[src]
pub const fn r_released(self) -> bool
[src]
pub const fn with_r_released(self, bit: bool) -> Self
[src]
pub const L_RELEASED_BIT: u16
[src]
pub const fn l_released(self) -> bool
[src]
pub const fn with_l_released(self, bit: bool) -> Self
[src]
Trait Implementations
impl PartialEq<KeyInput> for KeyInput
[src]
impl Eq for KeyInput
[src]
impl Copy for KeyInput
[src]
impl Debug for KeyInput
[src]
impl Clone for KeyInput
[src]
fn clone(&self) -> KeyInput
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for KeyInput
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,