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 more