gilrs
Game Input Library for Rust
0.11.2
7.9M downloads/mo
#3526 most downloaded on crates.io
source
What this package is like to depend on
Last release 2 months ago
30 May 2026
Release timing varies
gaps range from 9 days to 1.3 years
Most releases are documented
notes for 31 of 39 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
39 releases · first in 2016
2 releases in the last 12 months
see the full history below
Release timeline
39 releases · Aug 2016 to May 2026Releases
latest 39-
0.11.230 May 2026Release notes
Open source →Changed
- MSRV is now 1.84
- Updated bundled mappings
- Always use forward slash in
include/include_str!
-
0.11.112 Jan 2026Release notes
Open source →Changed
- Updated bundled mappings. (!167)
Added
- Added
LinuxGamepadExttrait withdevpathmethod. (!166, !167) - It is now possible to disable force feedback support
via
GilrsBuilder::with_force_feedback. (!165)
-
0.11.015 Sep 2024Release notes
Open source →Breaking changes
- Mark Error enums,
EventTypeandEventasnon_exhaustive
Added
- Added
EventType::ForceFeedbackEffectCompleted
Changed
- Minimal supported Rust version is now 1.73
- Updated dependencies
- Updated bundled mappings
Fixed
- Fixed potential overflow in
btn_value
- Mark Error enums,
-
0.10.1015 Sep 2024Nothing published for this version
-
0.10.928 Jul 2024Nothing published for this version
-
0.10.806 Jul 2024Nothing published for this version
-
0.10.728 Apr 2024Nothing published for this version
-
0.10.616 Mar 2024Release notes
Open source →Fixed
axis_dpad_to_buttonfilter will now properly generate release event when axis value change from -1 to 1 (or 1 to -1) while skipping 0.
-
0.10.506 Mar 2024 -
0.10.403 Dec 2023Release notes
Open source →Fixed
- Fixed
Gilrs::set_mapping*returningMappingError::NotConnectedfor connected gamepads. - Fix not setting other axis to 0 when in deadzone range.
- Fixed
-
0.10.311 Nov 2023Release notes
Open source →Changed
- All thread spawned by gilrs are now named. (!102)
- MSRV is now 1.65.
-
0.10.223 Apr 2023Release notes
Open source →Added
Gilrs::next_event_blocking()
Fixed
- Parse more SDL specific buttons in mappings
- Recognize "xinput" UUID in mappings
- Parse axis ranges in button mappings
-
0.10.113 Nov 2022Release notes
Open source →Added
- Supporting files and documentation for running the GUI example using Wasm in a browser. See examples/wasm/README.md
Changed
- Bundled SDL mappings are now filtered by platform, reducing binary size.
Fixed
- GUI example crash when the current platform does not support force feedback.
-
0.10.006 Nov 2022Release notes
Open source →Changed
-
Windows now defaults to using Windows Gaming Input instead of xinput.
If you need to use xInput you can disable the
wgifeature (It's enabled by default) and enable thexinputfeature.gilrs = {version = "0.10.0", default-features = false, features = ["wgi"]} -
Apps on Windows will now require a focused window to receive inputs by default.
This is a limitation of Windows Gaming Input. It requires an in focus Window be associated with the process to receive events. You can still switch back to using xInput by turning off default features and enabling the
xinputfeature.Note: Some (Older?) devices may still report inputs without a window but this is not the case for all devices so if you are writing a terminal based game, use the
xinputfeature instead. -
Minimal supported rust version is now 1.64.
-
-
0.9.022 May 2022Release notes
Open source →Changed
- wasm: web-sys/wasm-bindgen is now used by default, dependency on stdweb
and
wasm-bindgenfeature are removed. - Minimal supported rust version is now 1.56.
- Changed
impl Into\<usize\> for GamepadIdtoimpl From\<GamepadId\> for usize
Fixed
- wasm:
next_event()no longer panic ifgetGamepads()is not available.
- wasm: web-sys/wasm-bindgen is now used by default, dependency on stdweb
and
-
0.8.230 Dec 2021Release notes
Open source →Changed
- Minimal supported rust version is now 1.47
axis_dpad_to_btnnow also emitsButtonChangedevents
Fixed
- Fixed overflow when calculating axis value and min/max range was i32::MIN/MAX (@wathiede)
-
0.8.130 Mar 2021 -
0.8.009 Oct 2020Release notes
Open source →Added
Jitter,Repeat,GilrsBuilder, andMappingnow implementDefault.- Errors now implement
source(). Codenow implementsDeserializeandSerialize(@theunkn0wn1).- Dpad is now supported on macOS (@cleancut).
Changed
- Minimal supported version is now 1.40
- Non exhaustive enums now use
#[non_exhaustive]instead of hidden variant. - Renamed cargo feature
serdetoserde-serialize. - Improved conversion of axis value to float. Values like 127 (when axis range is 0-255) will now be correctly converted to 0.0.
Removed
- Errors now longer implement deprecated methods (
source()anddescription()).
-
0.7.406 Feb 2020Release notes
Open source →Added
- Added method to stop playing force feedback effect. (@photex)
Fixed
- Fixed bug that caused forced feedback effects to never stop. (@photex)
-
0.7.330 Nov 2019Release notes
Open source →Added
- Added support for serialization and deserialization for
Button,AxisandAxisOrButtonwith optionalserdefeature (@aleksijuvani).
Fixed
- Fixed defaults mappings containing elements that gamepad doesn't have.
This also fixes state not working for
LeftTriggerbutton on Windows.
- Added support for serialization and deserialization for
-
0.7.206 Aug 2019 -
0.7.104 Mar 2019Release notes
Open source →Fixed
- Compilation on macOS.
- xinput: Calling
set_ff_state()on devices that were never connected. GamepadIdwas not reexported from private module.
-
0.7.021 Feb 2019Release notes
Open source →Added
GamepadIdGilrs::gamepad(id). This function is replacement forIndexoperator and can return disconnected gamepads.- Initial support for macOS (@jtakakura). There are still some functionality missing, check related issues in #58.
- Wasm support, using stdweb (@ryanisaacg).
Changed
- Change
Gamepad::uuid -> UuidtoGamepad::uuid -> [u8; 16] gilrsnow usesgilrs-corecrate as backend. Because of it, there are some breaking changes to API.- Functions that returned
&Gamepadnow returnGamepad<'_>proxy object. - Renamed
Gilrs::get(id)toGilrs::connected_gamepad(id). - Moved
Gamepad::set_mapping{,_strict}()toGilrs. These functions now also take gamepad id as additional argument. - Minimal supported version is now 1.31.1. The crate can still be build with older rustc, but it may change during next patch release.
- Instead using
usizefor gamepad ID,GamepadIdis now used. - Updated bundled SDL_GameControllerDB.
Removed
- All functions that returned
&mut Gamepad. Gilrsno longer implementsIndexandIndexMutoperators. UseGilrs::gamepad(id)instead.Gamepad::status()andStatusenum.Gamepad::is_connected()is now sufficient to determine status of gamepad.
Fixed
- xinput: Incorrect gamepad ID when more than one gamepad is connected (@DTibbs).
- Deadzone filter no longer emits additional events. This resulted in emitting more events until values normalized on some, often unrelated (like 0 for axis around 0.5), value.
- Mappings from environment variable had lower priority than bundled mappings.
-
0.6.314 Jan 2019Nothing published for this version
-
0.6.212 Jan 2019Nothing published for this version
-
0.6.118 Jul 2018Release notes
Open source →Added
Changed
- The URL of repository has changed to https://gitlab.com/gilrs-project/gilrs
- Updated bundled SDL_GameControllerDB.
Fixed
- Various fixes to logging at incorrect log level. Thanks to @fuggles for locating and reporting these issues.
- Possible panic in
Repeatfilter. -
Axis::DPadYwas inverted on Linux.
Release notes
Open source →Added
ev::Code::into_u32()(@rukai).ev::{Button, Axis, AxisOrBtn}now implementsHash(@sheath).
Changed
- The URL of repository has changed to https://gitlab.com/gilrs-project/gilrs
- Updated bundled SDL_GameControllerDB.
Fixed
- Various fixes to logging at incorrect log level. Thanks to @fuggles for locating and reporting these issues.
- Possible panic in
Repeatfilter. Axis::DPadYwas inverted on Linux.
-
0.6.011 Feb 2018Release notes
Open source →Added
- Support for parsing SLD 2.0.6 mappings.
-
ButtonChangedevent. It contains value in range [0.0, 1.0]. -
GilrsBuilder::set_axis_to_btn(). It allow to customize on which valuesButtonePressedandButtonReleasedare emitted. -
GilrsBuilder::set_update_statewhich control whether gamepad state should be updated automatically. -
ButtonState::value(). -
Mapping::insert_{btn,axis}(). -
Gampead::os_name()andGamepad::map_name(). (@rukai) -
GilrsBuilder::add_env_mappings()andGilrsBuilder::add_included_mappings(), allow to configure whether to load mappings fromSDL_GAMECONTROLLERCONFIGenv and bundled mappings. (@rukai) -
Gilrs::insert_event(). -
Axis::second_axis()– returns the other axis of gamepad element. For example, this function will returnLeftStickXforLeftStickY.
Removed
-
Mappingno longer implementsIndexandIndexMutoperators. UseMapping::insert_{btn,axis}()methods to add new mappings. -
Axis::{LeftTrigger, LeftTrigger2, RightTrigger, RightTrigger2}. All events with these are now button events.ButtonChangedevent contains value. -
Gilrs::gamepad()andGilrs::gamepad_mut()– useIndexoperator instead.
Changed
- Gilrs now require Rust 1.20.0 or newer.
- Updated bundled mappings.
- Renamed
Filter::filtertoFilter::filter_evbecause RFC 2124 addedfiltermethod toOption(ourFilteris implemented forOption<Event>). -
Gamepad::deadzone()now returnsOption<f32>instead off32. - All axis events are now in range [-1.0, 1.0].
-
NativeEvCodeis replaced byev::Code, a strongly typed struct that also distinguish between axes and buttons. - You can now create mappings from any axis to any button.
-
Statenow tracks floating-point value of buttons. -
State::value()can now be used to also examine value of buttons. - By default, gamepad state is updated automatically. If you customize event
filters, you can disable this behaviour using
GilrsBuilder::set_update_state. -
Gilrs::new()andGilrsBuilder::build()now returnsResult. Dummy context can still be used, but only if result of failure is unsupported platform. - Renamed
Gilrs::connected_gamepad()andGilrs::connected_gamepad_mut()toget()andget_mut(). -
FilterandFilterFnnow borrowsGilrsmutably. - Windows: Gamepads are now named "Xbox Controller" instead of "XInput Controller". (@rukai)
Fixed
- Incorrect ranges for some axes.
- Deadzone filter should no longer produce values outside of allowed range.
- When calculating deadzone, the value of second axis is no longer ignored. This fixes situation, when sometimes axis would stay on value small to 0.0, when it should be 0.0 instead.
- Deadzone threshold was half of what it should be.
- Linux: Fixed axis value normalization if neither minimal value is 0 nor midpoint is 0. (@scottpleb)
- Linux: Ensure that axis values are clamped after normalization. (@scottpleb)
- Linux: Compilation error on architectures with
c_char = u8.
Release notes
Open source →Added
- Support for parsing SLD 2.0.6 mappings.
ButtonChangedevent. It contains value in range [0.0, 1.0].GilrsBuilder::set_axis_to_btn(). It allow to customize on which valuesButtonePressedandButtonReleasedare emitted.GilrsBuilder::set_update_statewhich control whether gamepad state should be updated automatically.ButtonState::value().Mapping::insert_{btn,axis}().Gampead::os_name()andGamepad::map_name(). (@rukai)GilrsBuilder::add_env_mappings()andGilrsBuilder::add_included_mappings(), allow to configure whether to load mappings fromSDL_GAMECONTROLLERCONFIGenv and bundled mappings. (@rukai)Gilrs::insert_event().Axis::second_axis()– returns the other axis of gamepad element. For example, this function will returnLeftStickXforLeftStickY.
Removed
Mappingno longer implementsIndexandIndexMutoperators. UseMapping::insert_{btn,axis}()methods to add new mappings.Axis::{LeftTrigger, LeftTrigger2, RightTrigger, RightTrigger2}. All events with these are now button events.ButtonChangedevent contains value.Gilrs::gamepad()andGilrs::gamepad_mut()– useIndexoperator instead.
Changed
- Gilrs now require Rust 1.20.0 or newer.
- Updated bundled mappings.
- Renamed
Filter::filtertoFilter::filter_evbecause RFC 2124 addedfiltermethod toOption(ourFilteris implemented forOption<Event>). Gamepad::deadzone()now returnsOption<f32>instead off32.- All axis events are now in range [-1.0, 1.0].
NativeEvCodeis replaced byev::Code, a strongly typed struct that also distinguish between axes and buttons.- You can now create mappings from any axis to any button.
Statenow tracks floating-point value of buttons.State::value()can now be used to also examine value of buttons.- By default, gamepad state is updated automatically. If you customize event
filters, you can disable this behaviour
using
GilrsBuilder::set_update_state. Gilrs::new()andGilrsBuilder::build()now returnsResult. Dummy context can still be used, but only if result of failure is unsupported platform.- Renamed
Gilrs::connected_gamepad()andGilrs::connected_gamepad_mut()toget()andget_mut(). FilterandFilterFnnow borrowsGilrsmutably.- Windows: Gamepads are now named "Xbox Controller" instead of "XInput Controller". (@rukai)
Fixed
- Incorrect ranges for some axes.
- Deadzone filter should no longer produce values outside of allowed range.
- When calculating deadzone, the value of second axis is no longer ignored. This fixes situation, when sometimes axis would stay on value small to 0.0, when it should be 0.0 instead.
- Deadzone threshold was half of what it should be.
- Linux: Fixed axis value normalization if neither minimal value is 0 nor midpoint is 0. (@scottpleb)
- Linux: Ensure that axis values are clamped after normalization. (@scottpleb)
- Linux: Compilation error on architectures with
c_char = u8.
-
0.5.230 Dec 2017Release notes
Open source → -
0.5.112 Nov 2017Release notes
Open source →Fixed
- Fixed compilation errors on recent nightly introduced by addition of
filtermethod toOption. If you want to use filters in your code on nightly, use universal function call syntax –Filter::filter(&ev, &filter, &gilrs)or 0.6 branch (at the moment unreleased).
- Fixed compilation errors on recent nightly introduced by addition of
-
0.5.024 Sep 2017Release notes
Open source →Added
-
Mapping::remove_button()andMapping::remove_axis(). -
GilrsBuilderfor customizing howGilrsis created. - Event filters. See
ev::filtermodule for more info. -
Gilrs::next_event()- use it withwhile letloop in your event loop. This allow to avoid borrow checker problems thatEventIteratorcaused. - New event –
Dropped. Used by filters to indicate that you should ignore this event. - New event –
ButtonRepeated. Can be emitted byRepeatfilter. Axis::{DPadX, DPadY}-
Gamepad::{button_name, axis_name, button_code, axis_code}functions for accessing mapping data. -
Gamepad::axis_data, button_data– part of new extended gamepad state. -
Gamepad::id()– returns gamepad ID. -
Gilrs::update, inc, counter, reset_counter– part of new extended gamepad state.
Removed
-
Gilrs::with_mappings()– useGilrsBuilder. -
Gilrs::poll_events()andEventIterator– useGilrs::next_event()instead.
Changed
- Minimal rust version is now 1.19
- New gamepad state. Now can store state for any button or axis (previously was
only useful for named buttons and axes). Additionally it now also know when
last event happened. Basic usage with
is_pressed()andvalue()methods is same, but check out documentation for new features. - Gamepad state now must be explicitly updated with
Gilrs::update(Event). This change was necessary because filters can change events. -
Eventis now a struct and contains common information like id of gamepad and timestamp (new). Old enum was renamed toEventTypeand can be accessed fromEvent.eventpublic field. - New force feedback module, including support for Windows. There are to many changes to list them all here, so pleas check documentation and examples.
- Renamed
ff::Error::EffectNotSupportedtoff::Error::NotSupported. -
Button::UnknownandAxis::Unknownhave now value of 0. -
Gamepad::set_mapping()(and_strictvariant) now returns error when creating mapping withButton::UnknownorAxis::Unknown. Additionally_strictversion does not allowButton::{C, Z}and Axis::{LeftZ, RightZ}. - xinput: New values for
NativEvCode
Fixed
- Panic on
unreachable!()when creating mapping withButton::{C, Z, Unknown}orAxis::{LeftZ, RightZ}.
Release notes
Open source →Added
Mapping::remove_button()andMapping::remove_axis().GilrsBuilderfor customizing howGilrsis created.- Event filters. See
ev::filtermodule for more info. Gilrs::next_event()- use it withwhile letloop in your event loop. This allow to avoid borrow checker problems thatEventIteratorcaused.- New event –
Dropped. Used by filters to indicate that you should ignore this event. - New event –
ButtonRepeated. Can be emitted byRepeatfilter. Axis::{DPadX, DPadY}Gamepad::{button_name, axis_name, button_code, axis_code}functions for accessing mapping data.Gamepad::axis_data, button_data– part of new extended gamepad state.Gamepad::id()– returns gamepad ID.Gilrs::update, inc, counter, reset_counter– part of new extended gamepad state.
Removed
Gilrs::with_mappings()– useGilrsBuilder.Gilrs::poll_events()andEventIterator– useGilrs::next_event()instead.
Changed
- Minimal rust version is now 1.19
- New gamepad state. Now can store state for any button or axis (previously was
only useful for named buttons and axes). Additionally it now also know when
last event happened. Basic usage with
is_pressed()andvalue()methods is same, but check out documentation for new features. - Gamepad state now must be explicitly updated with
Gilrs::update(Event). This change was necessary because filters can change events. Eventis now a struct and contains common information like id of gamepad and timestamp (new). Old enum was renamed toEventTypeand can be accessed fromEvent.eventpublic field.- New force feedback module, including support for Windows. There are to many changes to list them all here, so pleas check documentation and examples.
- Renamed
ff::Error::EffectNotSupportedtoff::Error::NotSupported. Button::UnknownandAxis::Unknownhave now value of 0.Gamepad::set_mapping()(and_strictvariant) now returns error when creating mapping withButton::UnknownorAxis::Unknown. Additionally_strictversion does not allowButton::{C, Z}and Axis::{LeftZ, RightZ}.- xinput: New values for
NativEvCode
Fixed
- Panic on
unreachable!()when creating mapping withButton::{C, Z, Unknown}orAxis::{LeftZ, RightZ}.
-
-
0.4.416 Jun 2017Release notes
Open source →v0.4.4 — 2017-06-16
Changed
- Gilrs no longer uses
ioctlcrate on Linux. Becauseioctlwas deprecated and all versions yanked, it was causing problems for new builds that didn't haveioctlcrate listed in Cargo.lock.
Release notes
Open source →Changed
- Gilrs no longer uses
ioctlcrate on Linux. Becauseioctlwas deprecated and all versions yanked, it was causing problems for new builds that didn't haveioctlcrate listed in Cargo.lock.
- Gilrs no longer uses
-
0.4.312 Mar 2017Release notes
Open source →v0.4.3 — 2017-03-12
Added
- You can now iterate over mutable references to connected gamepads using
Gilrs::gamepads_mut().
Fixed
- Fixed
unreachable!()panic on 32bit Linux. - Improved converting axes values to
f32when using XInput.
Release notes
Open source →Added
- You can now iterate over mutable references to connected gamepads using
Gilrs::gamepads_mut().
Fixed
- Fixed
unreachable!()panic on 32bit Linux - Improved converting axes values to
f32when using XInput
- You can now iterate over mutable references to connected gamepads using
-
0.4.215 Jan 2017Release notes
Open source →v0.4.2 - 2017-01-15
Changed
- Updated SDL_GameControllerDB to latest revision.
- Changes in axes values that are less than 1% are now ignored.
Fixed
- Fixed multiple axes mapped to same axis name when mappings are incomplete.
- Values returned with
AxisChangedevent now have correctly applied deadzones. - Linux: Correctly handle event queue overrun.
Release notes
Open source →Changed
- Updated SDL_GameControllerDB to latest revision.
- Changes in axes values that are less than 1% are now ignored.
Fixed
- Fixed multiple axes mapped to same axis name when mappings are incomplete.
- Values returned with
AxisChangedevent now have correctly applied deadzones. - Linux: Correctly handle event queue overrun.
-
0.4.112 Dec 2016Release notes
Open source → -
0.4.011 Dec 2016Release notes
Open source →v0.4.0 - 2016-12-11
Added
-
Gamepad::mappings_source(&self)which can be used to filter gamepads which not provide unified controller layout -
MappingsSourceenum - You can now set custom mapping for gamepad with
Gamepad::set_mapping(…) -
Gilrs::with_mappings(&str)to create Gilrs with additional gamepad mappings
Changed
- Button and axis events now also have native event codes
- On Linux, if button or axis is not known, is now reported as
Unknown(previously all unknown events have been ignored) - More devices are now treated as gamepads on Linux (use
mappings_source()to filter unwanted gamepads) - Renamed
{Gamepad,GamepadState}::is_btn_pressed(Button)tois_pressed(Button) - Renamed
{Gamepad,GamepadState}::axis_val(Axis)tovalue(Axis)
Fixed
- Integer overflow if button with keyboard code was pressed on Linux
-
Gilrsshould no longer panic if there are some unexpected problems with Udev - Fixed normalization of axes values on Linux
Release notes
Open source →Added
Gamepad::mappings_source(&self)which can be used to filter gamepads which not provide unified controller layoutMappingsSourceenum- You can now set custom mapping for gamepad with
Gamepad::set_mapping(…) Gilrs::with_mappings(&str)to create Gilrs with additional gamepad mappings
Changed
- Button and axis events now also have native event codes
- On Linux, if button or axis is not known, is now reported as
Unknown(previously all unknown events have been ignored) - More devices are now treated as gamepads on Linux (use
mappings_source()to filter unwanted gamepads) - Renamed
{Gamepad,GamepadState}::is_btn_pressed(Button)tois_pressed(Button) - Renamed
{Gamepad,GamepadState}::axis_val(Axis)tovalue(Axis)
Fixed
- Integer overflow if button with keyboard code was pressed on Linux
Gilrsshould no longer panic if there are some unexpected problems with Udev- Fixed normalization of axes values on Linux
-
-
0.3.123 Sep 2016 -
0.3.022 Sep 2016Release notes
Open source →Added
Gamepad::power_info(&self)ff::Direction::from_radians(f32)andff::Direction::from_vector([f32; 2])Gilrs::gamepads(&self)which returns iterator over all connected gamepadsGamepadStatenow implementsis_btn_pressed(Button)andaxis_val(Axis)Gilrsnow implementsIndexandIndexMut
Changed
- Rename
Button::UnknowtoButton::Unknown Gamepad::name(&self)now returns&strinstead of&String- Improved dead zone detection
Effect::play(&self, u16)now returnsResult<(), Error>- Linux: Reduced memory usage
Removed
ff::Directionno longer implementsFrom<f32>
Fixed
- Buttons west and east are no longer swapped when using SDL2 mappings
- Linux: infinite loop after gamepad disconnects
- Linux: SDL2 mappings for gamepads that can also report mouse and keyboard events now should works
v0.2.0 - 2016-08-18
Changed
- Rename
Gilrs::pool_events()toGilrs::poll_events()
Fixed
- Linux: Disconnected events are now emitted properly
- Linux: All force feedback effects are now dropped when gamepad disconnects
-
0.2.018 Aug 2016Nothing published for this version
-
0.1.017 Aug 2016Nothing published for this version