Skip to content

Commit

Permalink
Add InputMap::clear (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shatur authored Dec 12, 2023
1 parent 4c9aaf5 commit 42e2fed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## Unreleased

- Added `InputMap::Clear`.

## Version 0.11.2

- fixed [a bug](https://github.com/Leafwing-Studios/leafwing-input-manager/issues/285) with mouse motion and mouse wheel events being improperly counted
Expand Down
7 changes: 7 additions & 0 deletions src/input_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,13 @@ impl<A: Actionlike> InputMap<A> {
pub fn is_empty(&self) -> bool {
self.len() == 0
}

/// Clears the map, removing all action-inputs pairs.
///
/// Keeps the allocated memory for reuse.
pub fn clear(&mut self) {
self.map.clear();
}
}

// Removing
Expand Down

0 comments on commit 42e2fed

Please sign in to comment.