Struct Input

Source
pub struct Input { /* private fields */ }
Expand description

Represents the current input state. The old key/mouse fields remain available for compatibility.

Implementations§

Source§

impl Input

Source

pub fn is_key_pressed(&self, key: VirtualKeyCode) -> bool

Checks to see if a key is pressed. True if it is, false otherwise.

Source

pub fn is_scancode_pressed(&self, scan_code: u32) -> bool

Checks to see if a key is pressed by scancode. True if it is, false if it isn’t.

Source

pub fn is_mouse_button_pressed(&self, button_num: usize) -> bool

Checks to see if a mouse button is pressed. 0 = left, 1 = right, 2 = middle, etc. is the convention for button numbering.

Source

pub fn mouse_button_pressed_set(&self) -> &HashSet<usize>

HashSet of pressed mouse buttons

Source

pub fn scan_code_pressed_set(&self) -> &HashSet<u32>

HashSet of pressed keyboard scan codes

Source

pub fn key_pressed_set(&self) -> &HashSet<VirtualKeyCode>

HashSet of pressed keyboard scan codes

Source

pub fn mouse_tile_pos(&self, console: usize) -> (i32, i32)

Returns the current mouse position (0,0 if there isn’t one yet), in TILE coordinates for the specified console layer.

Source

pub fn mouse_tile(&self, console: usize) -> Point

Returns the current mouse position (0,0 if there isn’t one yet), in TILE coordinates for the specified console layer in Point format.

Source

pub fn mouse_pixel_pos(&self) -> (f64, f64)

Return the current mouse position in pixels.

Source

pub fn activate_event_queue(&mut self)

Call this to enable the event queue. Otherwise, events will not be tracked/stored outside of the HAL setup (to avoid continually filling a buffer that isn’t being used).

Source

pub fn pop(&mut self) -> Option<BEvent>

Pop a single event from the event queue. Returns None if there aren’t any events.

Source

pub fn for_each_message<F>(&mut self, action: F)
where F: FnMut(BEvent),

Provides a for_each function for all messages in the queue.

Source

pub fn get_scale_factor(&self) -> f64

Gets the current scale factor

Trait Implementations§

Source§

impl Clone for Input

Source§

fn clone(&self) -> Input

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Input

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Input

§

impl RefUnwindSafe for Input

§

impl Send for Input

§

impl Sync for Input

§

impl Unpin for Input

§

impl UnwindSafe for Input

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.