Struct buttons::Touchpad

source ·
pub struct Touchpad<Id, Coord>where
    Id: PartialEq,
    Coord: Copy + Default + Add<Output = Coord>,{ /* private fields */ }
Expand description

A structure representing the current state of touches on a touch device.

Implementations§

source§

impl<Id, Coord> Touchpad<Id, Coord>where Id: PartialEq, Coord: Copy + Default + Add<Output = Coord>,

source

pub fn new() -> Self

source

pub fn first_touch(&self) -> Option<&Touch<Id, Coord>>

Returns a reference to the first registered touch, if any.

source

pub fn touch<I: AsRef<Id>>(&self, id: I) -> Option<&Touch<Id, Coord>>

Returns a touch by its id, if it exists.

source

pub fn touches(&self) -> impl Iterator<Item = &Touch<Id, Coord>>

Returns an iterator over all active touches.

(This includes touches that have been released this frame.)

source

pub fn touch_event<I, P>( &mut self, id: I, position: [Coord; 2], phase: P ) -> &mut Selfwhere I: Into<Id>, P: Into<TouchPhase>,

Register a touch event.

source

pub fn clear_taps(&mut self) -> &mut Self

Clears the tapped/released state of active touches. Should be called at the end of each frame.

source

pub fn handle_event<E: Event<Self>>(&mut self, event: &E) -> &mut Self

Convenience method for handling events. The type of event, E, will vary depending on the windowing library being used.

Trait Implementations§

source§

impl<Id, Coord> Clone for Touchpad<Id, Coord>where Id: PartialEq + Clone, Coord: Copy + Default + Add<Output = Coord> + Clone,

source§

fn clone(&self) -> Touchpad<Id, Coord>

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<Id, Coord> Debug for Touchpad<Id, Coord>where Id: PartialEq + Debug, Coord: Copy + Default + Add<Output = Coord> + Debug,

source§

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

Formats the value using the given formatter. Read more
source§

impl<Id, Coord> Default for Touchpad<Id, Coord>where Id: PartialEq, Coord: Copy + Default + Add<Output = Coord>,

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'a, T> Event<Touchpad<u64, f64>> for WinitEvent<'a, T>

source§

fn handle(&self, touchpad: &mut Touchpad<u64, f64>)

Modify the state of the provided handler (for example, a Mouse or Keyboard). Read more

Auto Trait Implementations§

§

impl<Id, Coord> RefUnwindSafe for Touchpad<Id, Coord>where Coord: RefUnwindSafe, Id: RefUnwindSafe,

§

impl<Id, Coord> Send for Touchpad<Id, Coord>where Coord: Send, Id: Send,

§

impl<Id, Coord> Sync for Touchpad<Id, Coord>where Coord: Sync, Id: Sync,

§

impl<Id, Coord> Unpin for Touchpad<Id, Coord>where Coord: Unpin, Id: Unpin,

§

impl<Id, Coord> UnwindSafe for Touchpad<Id, Coord>where Coord: UnwindSafe, Id: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.