Struct gilrs::ff::EffectBuilder
source · pub struct EffectBuilder { /* private fields */ }
Expand description
Creates new Effect
.
Implementations§
source§impl EffectBuilder
impl EffectBuilder
sourcepub fn new() -> Self
pub fn new() -> Self
Creates new builder with following defaults: no gamepads, no base effects, repeat set to
infinitely, no distance model, position in (0.0, 0.0, 0.0) and gain 1.0. Use finish()
to
create new effect.
sourcepub fn add_effect(&mut self, effect: BaseEffect) -> &mut Self
pub fn add_effect(&mut self, effect: BaseEffect) -> &mut Self
Adds new BaseEffect
.
sourcepub fn gamepads(&mut self, ids: &[GamepadId]) -> &mut Self
pub fn gamepads(&mut self, ids: &[GamepadId]) -> &mut Self
Changes gamepads that are associated with effect. Effect will be only played on gamepads from last call to this function.
sourcepub fn add_gamepad(&mut self, gamepad: &Gamepad<'_>) -> &mut Self
pub fn add_gamepad(&mut self, gamepad: &Gamepad<'_>) -> &mut Self
Adds gamepad to the list of gamepads associated with effect.
sourcepub fn repeat(&mut self, repeat: Repeat) -> &mut Self
pub fn repeat(&mut self, repeat: Repeat) -> &mut Self
Changes what should happen to effect when it ends.
sourcepub fn distance_model(&mut self, model: DistanceModel) -> &mut Self
pub fn distance_model(&mut self, model: DistanceModel) -> &mut Self
Changes distance model associated with effect.
sourcepub fn position<Vec3f: Into<[f32; 3]>>(&mut self, position: Vec3f) -> &mut Self
pub fn position<Vec3f: Into<[f32; 3]>>(&mut self, position: Vec3f) -> &mut Self
Changes position of the source of effect.
sourcepub fn gain(&mut self, gain: f32) -> &mut Self
pub fn gain(&mut self, gain: f32) -> &mut Self
Changes gain of the effect. gain
will be clamped to [0.0, f32::MAX].
sourcepub fn finish(&mut self, gilrs: &mut Gilrs) -> Result<Effect, Error>
pub fn finish(&mut self, gilrs: &mut Gilrs) -> Result<Effect, Error>
Validates all parameters and creates new effect.
Errors
Returns Error::Disconnected(id)
or Error::FfNotSupported(id)
on first gamepad in ids
that is disconnected or doesn’t support force feedback.
Returns Error::InvalidDistanceModel
if model
is not valid. See
DistanceModel
for details.
Trait Implementations§
source§impl Clone for EffectBuilder
impl Clone for EffectBuilder
source§fn clone(&self) -> EffectBuilder
fn clone(&self) -> EffectBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for EffectBuilder
impl Debug for EffectBuilder
source§impl Default for EffectBuilder
impl Default for EffectBuilder
source§impl PartialEq for EffectBuilder
impl PartialEq for EffectBuilder
source§fn eq(&self, other: &EffectBuilder) -> bool
fn eq(&self, other: &EffectBuilder) -> bool
self
and other
values to be equal, and is used
by ==
.