Struct gilrs::GilrsBuilder
source · pub struct GilrsBuilder {
mappings: MappingDb,
default_filters: bool,
axis_to_btn_pressed: f32,
axis_to_btn_released: f32,
update_state: bool,
env_mappings: bool,
included_mappings: bool,
}
Expand description
Allow to create Gilrs
with customized behaviour.
Fields§
§mappings: MappingDb
§default_filters: bool
§axis_to_btn_pressed: f32
§axis_to_btn_released: f32
§update_state: bool
§env_mappings: bool
§included_mappings: bool
Implementations§
source§impl GilrsBuilder
impl GilrsBuilder
sourcepub fn with_default_filters(self, default_filters: bool) -> Self
pub fn with_default_filters(self, default_filters: bool) -> Self
If true
, use axis_dpad_to_button
,
Jitter
and deadzone
filters with default parameters. Defaults to true
.
sourcepub fn add_mappings(self, mappings: &str) -> Self
pub fn add_mappings(self, mappings: &str) -> Self
Adds SDL mappings.
sourcepub fn add_env_mappings(self, env_mappings: bool) -> Self
pub fn add_env_mappings(self, env_mappings: bool) -> Self
If true, will add SDL mappings from SDL_GAMECONTROLLERCONFIG
environment variable.
Defaults to true.
sourcepub fn add_included_mappings(self, included_mappings: bool) -> Self
pub fn add_included_mappings(self, included_mappings: bool) -> Self
If true, will add SDL mappings included from https://github.com/gabomdq/SDL_GameControllerDB. Defaults to true.
sourcepub fn set_axis_to_btn(self, pressed: f32, released: f32) -> Self
pub fn set_axis_to_btn(self, pressed: f32, released: f32) -> Self
Sets values on which ButtonPressed
and ButtonReleased
events will be emitted. build()
will return error if pressed ≤ released
or if one of values is outside [0.0, 1.0].
Defaults to 0.75 for pressed
and 0.65 for released
.
sourcepub fn set_update_state(self, enabled: bool) -> Self
pub fn set_update_state(self, enabled: bool) -> Self
Disable or enable automatic state updates. You should use this if you use custom filters; in this case you have to update state manually anyway.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GilrsBuilder
impl RefUnwindSafe for GilrsBuilder
impl Send for GilrsBuilder
impl Sync for GilrsBuilder
impl Unpin for GilrsBuilder
impl UnwindSafe for GilrsBuilder
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