[][src]Struct gilrs::ff::Effect

pub struct Effect { /* fields omitted */ }

Handle to force feedback effect.

Effect represents force feedback effect that can be played on one or more gamepads. It uses a form of reference counting, so it can be cheaply cloned. To create new Effect use EffectBuilder.

All methods on can return Error::SendFailed although it shouldn't normally happen.

Methods

impl Effect
[src]

pub fn play(&self) -> Result<(), Error>
[src]

Plays effect on all associated gamepads.

pub fn set_gamepads(&self, ids: &[usize], gilrs: &Gilrs) -> Result<(), Error>
[src]

Changes gamepads that are associated with effect. Effect will be only played on gamepads from last call to this function.

Errors

Returns Error::Disconnected(id) or Error::FfNotSupported(id) on first gamepad in ids that is disconnected or doesn't support force feedback.

pub fn add_gamepad(&self, gamepad: &Gamepad) -> Result<(), Error>
[src]

Adds gamepad to the list of gamepads associated with effect.

Errors

Returns Error::Disconnected(id) or Error::FfNotSupported(id) if gamepad is not connected or does not support force feedback.

pub fn set_repeat(&self, repeat: Repeat) -> Result<(), Error>
[src]

Changes what should happen to effect when it ends.

pub fn set_distance_model(&self, model: DistanceModel) -> Result<(), Error>
[src]

Changes distance model associated with effect.

Errors

Returns Error::InvalidDistanceModel if model is not valid. See DistanceModel for details.

pub fn set_position<Vec3f: Into<[f32; 3]>>(
    &self,
    position: Vec3f
) -> Result<(), Error>
[src]

Changes position of the source of effect.

pub fn set_gain(&self, gain: f32) -> Result<(), Error>
[src]

Changes gain of the effect. gain will be clamped to [0.0, f32::MAX].

Trait Implementations

impl Clone for Effect
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Drop for Effect
[src]

impl Eq for Effect
[src]

impl PartialEq<Effect> for Effect
[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Hash for Effect
[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl Send for Effect

impl !Sync for Effect

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]