pub enum Tri {
Positive = 1,
Zero = 0,
Negative = -1,
}
Expand description
Tri-state enum. Allows for -1, 0 and +1. Useful if checking if the D-Pad is pointing left, right, or unpressed.
Note that Tri can be converted directly to a signed integer, so can easily be used to update positions of things in games
§Examples
use agb::input::Tri;
let x = 5;
let tri = Tri::Positive; // e.g. from button_controller.x_tri()
assert_eq!(x + tri as i32, 6);
Variants§
Trait Implementations§
source§impl Ord for Tri
impl Ord for Tri
source§impl PartialOrd for Tri
impl PartialOrd for Tri
impl Copy for Tri
impl Eq for Tri
impl StructuralPartialEq for Tri
Auto Trait Implementations§
impl RefUnwindSafe for Tri
impl Send for Tri
impl Sync for Tri
impl Unpin for Tri
impl UnwindSafe for Tri
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
Mutably borrows from an owned value. Read more