pub struct InputState {
pub pointer: PointerState,
pub modifiers: ModifierKeys,
pub scroll_delta: (f64, f64),
pub drag: Option<DragState>,
pub dt: f64,
pub time: f64,
pub multi_touch: Option<TouchState>,
}Expand description
Platform-agnostic input state snapshot
Fields§
§pointer: PointerState§modifiers: ModifierKeys§scroll_delta: (f64, f64)§drag: Option<DragState>§dt: f64§time: f64§multi_touch: Option<TouchState>Implementations§
Source§impl InputState
impl InputState
pub fn new() -> Self
pub fn with_pointer_pos(self, x: f64, y: f64) -> Self
pub fn pointer_pos(&self) -> Option<(f64, f64)>
pub fn is_hovered(&self, rect: &Rect) -> bool
pub fn is_clicked(&self) -> bool
pub fn is_double_clicked(&self) -> bool
pub fn is_middle_clicked(&self) -> bool
pub fn is_right_clicked(&self) -> bool
pub fn is_mouse_down(&self) -> bool
pub fn is_dragging(&self) -> bool
pub fn drag_delta(&self) -> Option<(f64, f64)>
pub fn shift(&self) -> bool
pub fn ctrl(&self) -> bool
pub fn alt(&self) -> bool
pub fn consume_click(&mut self) -> bool
pub fn consume_scroll(&mut self) -> (f64, f64)
Sourcepub fn touch_count(&self) -> usize
pub fn touch_count(&self) -> usize
Get active touch count
pub fn primary_pointer(&self) -> Option<(f64, f64)>
pub fn end_frame(&mut self)
Trait Implementations§
Source§impl Clone for InputState
impl Clone for InputState
Source§fn clone(&self) -> InputState
fn clone(&self) -> InputState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InputState
impl Debug for InputState
Source§impl Default for InputState
impl Default for InputState
Source§fn default() -> InputState
fn default() -> InputState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for InputState
impl RefUnwindSafe for InputState
impl Send for InputState
impl Sync for InputState
impl Unpin for InputState
impl UnsafeUnpin for InputState
impl UnwindSafe for InputState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more