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
impl Input
Sourcepub fn is_key_pressed(&self, key: VirtualKeyCode) -> bool
pub fn is_key_pressed(&self, key: VirtualKeyCode) -> bool
Checks to see if a key is pressed. True if it is, false otherwise.
Sourcepub fn is_scancode_pressed(&self, scan_code: u32) -> bool
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.
Checks to see if a mouse button is pressed. 0 = left, 1 = right, 2 = middle, etc. is the convention for button numbering.
HashSet of pressed mouse buttons
Sourcepub fn scan_code_pressed_set(&self) -> &HashSet<u32>
pub fn scan_code_pressed_set(&self) -> &HashSet<u32>
HashSet of pressed keyboard scan codes
Sourcepub fn key_pressed_set(&self) -> &HashSet<VirtualKeyCode>
pub fn key_pressed_set(&self) -> &HashSet<VirtualKeyCode>
HashSet of pressed keyboard scan codes
Sourcepub fn mouse_tile_pos(&self, console: usize) -> (i32, i32)
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.
Sourcepub fn mouse_tile(&self, console: usize) -> Point
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.
Sourcepub fn mouse_pixel_pos(&self) -> (f64, f64)
pub fn mouse_pixel_pos(&self) -> (f64, f64)
Return the current mouse position in pixels.
Sourcepub fn activate_event_queue(&mut self)
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).
Sourcepub fn pop(&mut self) -> Option<BEvent>
pub fn pop(&mut self) -> Option<BEvent>
Pop a single event from the event queue. Returns None if there aren’t any events.
Sourcepub fn for_each_message<F>(&mut self, action: F)
pub fn for_each_message<F>(&mut self, action: F)
Provides a for_each function for all messages in the queue.
Sourcepub fn get_scale_factor(&self) -> f64
pub fn get_scale_factor(&self) -> f64
Gets the current scale factor