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,
force_feedback: 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§force_feedback: boolImplementations§
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 with_force_feedback(self, enable_ff: bool) -> Self
pub fn with_force_feedback(self, enable_ff: bool) -> Self
If true, enables force feedback support. 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.