[−]Struct rltk::Input
Represents the current input state. The old key/mouse fields remain available for compatibility.
Methods
impl Input
pub fn is_key_pressed(&self, key: VirtualKeyCode) -> bool
Checks to see if a key is pressed. True if it is, false otherwise.
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.
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.
pub fn mouse_button_pressed_set(&self) -> &HashSet<usize, RandomState>
HashSet of pressed mouse buttons
pub fn scan_code_pressed_set(&self) -> &HashSet<u32, RandomState>
HashSet of pressed keyboard scan codes
pub fn key_pressed_set(&self) -> &HashSet<VirtualKeyCode, RandomState>
HashSet of pressed keyboard scan codes
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.
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.
pub fn mouse_pixel_pos(&self) -> (f64, f64)
Return the current mouse position in pixels.
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).
pub fn pop(&mut self) -> Option<BEvent>
Pop a single event from the event queue. Returns None if there aren't any events.
pub fn for_each_message<F>(&mut self, action: F) where
F: FnMut(BEvent),
F: FnMut(BEvent),
Provides a for_each function for all messages in the queue.
pub fn get_scale_factor(&self) -> f64
Gets the current scale factor
Trait Implementations
impl Clone for Input
fn clone(&self) -> Input
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Input
Auto Trait Implementations
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnwindSafe for Input
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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> 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<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,