- now supports Bevy 0.15 and bevy_egui 0.31
- fixed the bug where the values of buttonlike
ActionState
s cann't be retrieved- now you can use
button_value
function ofActionState
to get the value of a buttonlike action - added
value
and friends as the fields ofaction_data::ButtonData
GamepadButton
andGamepadButtonType
now get values fromAxis<GamepadButton>
VirtualAxis
,VirtualDPad
, andVirtualDPad3D
now report axis values based on the values of the constitute buttons- added
value
field toActionDiff::Pressed
- now you can use
- added missing deserializer function for
MouseButton
- made virtual axial controls more flexible, accepting any kind of
Buttonlike
- removed
KeyboardVirtualAxis
andGamepadVirtualAxis
in favor ofVirtualAxis
- removed
KeyboardVirtualDPad
andGamepadVirtualDPad
in favor ofVirtualDPad
- removed
KeyboardVirtualDPad3D
in favor ofVirtualDPad3D
- removed
- added
threshold
value forGamepadControlDirection
,MouseMoveDirection
, andMouseScrollDirection
to be considered pressed. - added ability to filter entities to generate action diffs for:
- added new
generate_action_diffs_filtered<A, F>
system, which accepts aQueryFilter
, so that only entities matching QueryFilterF
(and withActionState<A>
) generate action diffs - added new
summarize_filtered<F>
function forSummarizedActionState<A>
(alongside the originalsummarize
).
- added new
- added
TripleAxislike
trait for inputs that track all X, Y, and Z axes.- added
KeyboardVirtualDPad3D
that consists of sixKeyCode
s to represent a triple-axis-like input. - added
TripleAxislikeChord
that groups aButtonlike
and aTripleAxislike
together. - added related variants such as:
InputControlType::TripleAxis
ActionDiff::TripleAxisChanged
- added
- Reflect
Component
andResource
, which enables accessing the data in the type registry
- added
#[actionlike]
for actions to set their input kinds, either on an enum or on its individual variants.
- Reflect
Component
andResource
, which enables accessing the data in the type registry
- allowed creating
DualAxisBounds
,DualAxisExclusion
, andDualAxisDeadZone
from their struct definitions directly. - added
at_least
andat_most
methods for those implementingWithAxisProcessorExt
trait. - added
at_least
,at_least_only_x
,at_least_only_y
,at_most
,at_most_only_x
, andat_most_only_y
methods for those implementingWithDualAxisProcessorExt
trait. - added
only_positive
andonly_negative
builders forAxisDeadZone
andAxisExclusion
.- added corresponding extension methods for those implementing
WithAxisProcessorExt
trait.
- added corresponding extension methods for those implementing
- added
only_positive
,only_positive_x
,only_positive_y
,only_negative
,only_negative_x
, andonly_negative_y
builders forDualAxisDeadZone
andDualAxisExclusion
.- added corresponding extension methods for those implementing
WithDualAxisProcessorExt
trait.
- added corresponding extension methods for those implementing
- Implement
MapEntities
, which lets networking crates translate owner entity IDs between ECS worlds
- fixed the broken deserialization of inputs and
InputMap
s InputMap::get_pressed
and siblings now check if the action kind is buttonlike before checking if they are pressed or released, avoiding a debug-mode panicInputMap::merge
is now compatible with all input kinds, previously limited to buttons
- added the
UserInput
trait, which can be divided into three subtraits:Buttonlike
,Axislike
andDualAxislike
- the
InputControlKind
for each action can be set via the newActionlike::input_control_kind
method. The derive will assume that all actions are buttonlike. - many methods such as
get
onInputMap
andActionState
have been split into three variants, one for each kind of input
- the
- there is now a clear division between buttonlike, axislike and dualaxislike data
- each action in an
Actionlike
enum now has a specificInputControlKind
, mapping it to one of these three categories - if you are storing non-buttonlike actions (e.g. movement) inside of your Actionlike enum, you must manually implement the trait
- pressed / released state can only be accessed for buttonlike data: invalid requests will always return released
f32
values can only be accessed for axislike data: invalid requests will always return 0.0ActionData
has been refactored, and now stores common data and input-kind specific data separately- 2-dimensional
DualAxisData
can only be accessed for dualaxislike data: invalid requests will always return (0.0, 0.0) Axislike
inputs can no longer be inserted directly into anInputMap
: instead, use theinsert_axis
methodAxislike
inputs can no longer be inserted directly into anInputMap
: instead, use theinsert_dual_axis
method
- each action in an
InputStreams
has been removed in favor of an extensibleCentralInputStore
type, which you can add your own raw input kinds toRawInputs
has been removed to ensure that clashes for new raw input kinds can be handled correctly- each of the built-in input methods (keyboard, mouse, gamepad) is now controlled by its own feature flag
- disable
default-features
to avoid paying the runtime and compile time costs for input kinds your project doesn't care about - the
bevy_gilrs
feature ofbevy
is now enabled via thegamepad
feature
- disable
- added
UserInput
impls for gamepad input events:- implemented
UserInput
for Bevy’sGamepadAxisType
-related inputs.GamepadStick
:DualAxislike
, continuous or discrete movement events of the left or right gamepad stick along both X and Y axes.GamepadControlAxis
:Axislike
, Continuous or discrete movement events of aGamepadAxisType
.GamepadControlDirection
:Buttonlike
, Discrete movement direction events of aGamepadAxisType
, treated as a button press.
- implemented
UserInput
for Bevy’sGamepadButtonType
directly. - added
GamepadVirtualAxis
, which implementsAxislike
, similar to the oldUserInput::VirtualAxis
using twoGamepadButtonType
s. - added
GamepadVirtualDPad
, which implementsDualAxislike
, similar to the oldUserInput::VirtualDPad
using fourGamepadButtonType
s.
- implemented
- added
UserInput
impls for keyboard inputs:- implemented
Buttonlike
forKeyCode
andModifierKey
- implemented
Buttonlike
forModifierKey
. - added
KeyboardVirtualAxis
, which implementsAxislike
, similar to the oldUserInput::VirtualAxis
using twoKeyCode
s. - added
KeyboardVirtualDPad
which implementsDualAxislike
, similar to the oldUserInput::VirtualDPad
using fourKeyCode
s.
- implemented
- added
UserInput
impls for mouse inputs:- implemented
UserInput
for movement-related inputs.MouseMove
:DualAxislike
, continuous or discrete movement events of the mouse both X and Y axes.MouseMoveAxis
:Axislike
, continuous or discrete movement events of the mouse on an axis, similar to the oldSingleAxis::mouse_motion_*
.MouseMoveDirection
:Buttonlike
, discrete movement direction events of the mouse on an axis, similar to the oldMouseMotionDirection
.
- implemented
UserInput
for wheel-related inputs.MouseScroll
:DualAxislike
, continuous or discrete movement events of the mouse wheel both X and Y axes.MouseScrollAxis
:Axislike
, continuous or discrete movement events of the mouse wheel on an axis, similar to the oldSingleAxis::mouse_wheel_*
.MouseScrollDirection
:ButtonLike
, discrete movement direction events of the mouse wheel on an axis, similar to the oldMouseWheelDirection
.
- implemented
- added
ButtonlikeChord
,AxislikeChord
andDualAxislikeChord
for combining multiple inputs, similar to the oldUserInput::Chord
.
Input processors allow you to create custom logic for axis-like input manipulation.
- added processor enums:
AxisProcessor
: Handles single-axis values.DualAxisProcessor
: Handles dual-axis values.
- added processor traits for defining custom processors:
CustomAxisProcessor
: Handles single-axis values.CustomDualAxisProcessor
: Handles dual-axis values.- added App extensions for registration of custom processors:
register_axis_processor
forCustomAxisProcessor
.register_dual_axis_processor
forCustomDualAxisProcessor
.
- added built-in processors (variants of processor enums and
Into<Processor>
implementors):- Digital Conversion: Discretizes values, returning
-1.0
.0.0
or1.0
:AxisProcessor::Digital
: Single-axis digital conversion.DualAxisProcessor::Digital
: Dual-axis digital conversion.
- Inversion: Reverses control (positive becomes negative, etc.)
AxisProcessor::Inverted
: Single-axis inversion.DualAxisInverted
: Dual-axis inversion, implementedInto<DualAxisProcessor>
.
- Sensitivity: Adjusts control responsiveness (doubling, halving, etc.).
AxisProcessor::Sensitivity
: Single-axis scaling.DualAxisSensitivity
: Dual-axis scaling, implementedInto<DualAxisProcessor>
.
- Value Bounds: Define the boundaries for constraining input values.
AxisBounds
: Restricts single-axis values to a range, implementedInto<AxisProcessor>
andInto<DualAxisProcessor>
.DualAxisBounds
: Restricts single-axis values to a range along each axis, implementedInto<DualAxisProcessor>
.CircleBounds
: Limits dual-axis values to a maximum magnitude, implementedInto<DualAxisProcessor>
.
- Deadzones: Ignores near-zero values, treating them as zero.
- Unscaled versions:
AxisExclusion
: Excludes small single-axis values, implementedInto<AxisProcessor>
andInto<DualAxisProcessor>
.DualAxisExclusion
: Excludes small dual-axis values along each axis, implementedInto<DualAxisProcessor>
.CircleExclusion
: Excludes dual-axis values below a specified magnitude threshold, implementedInto<DualAxisProcessor>
.
- Scaled versions:
AxisDeadZone
: Normalizes single-axis values based onAxisExclusion
andAxisBounds::default
, implementedInto<AxisProcessor>
andInto<DualAxisProcessor>
.DualAxisDeadZone
: Normalizes dual-axis values based onDualAxisExclusion
andDualAxisBounds::default
, implementedInto<DualAxisProcessor>
.CircleDeadZone
: Normalizes dual-axis values based onCircleExclusion
andCircleBounds::default
, implementedInto<DualAxisProcessor>
.
- Unscaled versions:
- Digital Conversion: Discretizes values, returning
- implemented
WithAxisProcessingPipelineExt
to manage processors forSingleAxis
andVirtualAxis
, integrating the common processing configuration. - implemented
WithDualAxisProcessingPipelineExt
to manage processors forDualAxis
andVirtualDpad
, integrating the common processing configuration.
- Actions can now be disabled at both the individual action and
ActionState
level - Disabling actions now resets their value, exposed via the
ActionState::reset
method ActionState::release_all
has been renamed toActionState::reset_all
and now resets the values ofAxislike
andDualAxislike
actions- the state of actions now continues to be updated while they are disabled. However, when checked, their value is always released / zero.
- this ensures that holding down an action, disabling it and then re-enabling it does not trigger just-pressed
- the values of disabled actions can be accessed by checking their
ActionData
directly
- added new fluent builders for creating a new
InputMap<A>
with short configurations:fn with(mut self, action: A, input: impl UserInput)
.fn with_one_to_many(mut self, action: A, inputs: impl IntoIterator<Item = impl UserInput>)
.fn with_multiple(mut self, bindings: impl IntoIterator<Item = (A, impl UserInput)>) -> Self
.fn with_gamepad(mut self, gamepad: Gamepad) -> Self
.
- added new iterators over
InputMap<A>
:actions(&self) -> impl Iterator<Item = &A>
for iterating over all registered actions.bindings(&self) -> impl Iterator<Item = (&A, &dyn UserInput)>
for iterating over all registered action-input bindings.
- removed
ToggleActions
resource in favor of new methods onActionState
:disable_all
,disable(action)
,enable_all
,enable(action)
, anddisabled(action)
.
MockInput
,RawInputs
andMutableInputStreams
have been removed in favor of methods on theButtonlike
,Axislike
andDualAxislike
traits- for example, rather than
app.press_input(KeyCode::Space)
callKeyCode::Space.press(app.world_mut())
- for example, rather than
- existing methods for quickly checking the value of buttons and axes have been moved to the
FetchUserInput
trait and retained for testing purposes
- fixed a bug where enabling a pressed action would read as
just_pressed
, and disabling a pressed action would read asjust_released
. - inputs are now handled correctly in the
FixedUpdate
schedule! Previously, theActionState
s were only updated in thePreUpdate
schedule, so you could have situations where an action was marked asjust_pressed
multiple times in a row (if theFixedUpdate
schedule ran multiple times in a frame) or was missed entirely (if theFixedUpdate
schedule ran 0 times in a frame). - Mouse motion and mouse scroll are now computed more efficiently and reliably, through the use of the new
AccumulatedMouseMovement
andAccumulatedMouseScroll
resources. - the
timing
field of theActionData
is now disabled by default. Timing information will only be collected if thetiming
feature is enabled. It is disabled by default because most games don't require timing information. (how long a button was pressed for)
- removed
ActionStateDriver
andupdate_action_state_from_interaction
, which allowed actions to be pressed bybevy_ui
buttons- this feature was not widely used and can be easily replicated externally
- the core pattern is simply calling
action_state.press(MyAction::Variant)
in one of your systems
- removed the
no_ui_priority
feature. To get this behavior, now just turn off the defaultui
feature - removed the
orientation
module, migrating tobevy_math::Rot2
- use the types provided in
bevy_math
instead
- use the types provided in
- remove action consuming (and various
consume
/consumed
methods) to reduce complexity and avoid confusing overlap with action disabling- write your own logic for cases where this was used: generally by working off of
ActionDiff
events that are consumed
- write your own logic for cases where this was used: generally by working off of
- renamed
InputMap::which_pressed
method toprocess_actions
to better reflect its current functionality for clarity. - the old
SingleAxis
is now:GamepadControlAxis
for gamepad axes.MouseMoveAxis::X
andMouseMoveAxis::Y
for continuous mouse movement.MouseScrollAxis::X
andMouseScrollAxis::Y
for continuous mouse wheel movement.
- the old
DualAxis
is now:GamepadStick
for gamepad sticks.MouseMove::default()
for continuous mouse movement.MouseScroll::default()
for continuous mouse wheel movement.
- the old
Modifier
is nowModifierKey
. - the old
MouseMotionDirection
is nowMouseMoveDirection
. - the old
MouseWheelDirection
is nowMouseScrollDirection
. - the old
UserInput::Chord
is nowInputChord
. - the old
UserInput::VirtualAxis
is now:GamepadVirtualAxis
for four gamepad buttons.KeyboardVirtualAxis
for four keys.MouseMoveAxis::X.digital()
andMouseMoveAxis::Y.digital()
for discrete mouse movement.MouseScrollAxis::X.digital()
andMouseScrollAxis::Y.digital()
for discrete mouse wheel movement.
- the old
UserInput::VirtualDPad
is now:GamepadVirtualDPad
for four gamepad buttons.KeyboardVirtualDPad
for four keys.MouseMove::default().digital()
for discrete mouse movement.MouseScroll::default().digital()
for discrete mouse wheel movement.
ActionDiff::ValueChanged
is nowActionDiff::AxisChanged
.ActionDiff::AxisPairChanged
is nowActionDiff::DualAxisChanged
.InputMap::iter
has been split intoiter_buttonlike
,iter_axislike
anditer_dual_axislike
.- The same split has been done for
InputMap::bindings
andInputMap::actions
.
- The same split has been done for
ActionState::axis_pair
andAxisState::clamped_axis_pair
now return a plainVec2
rather than anOption<Vec2>
for consistency with their single axis and buttonlike brethren.BasicInputs::clashed
is nowBasicInput::clashes_with
to improve clarityBasicInputs::Group
is nowBasicInputs::Chord
to improve clarityBasicInputs
now only tracks buttonlike user inputs, and a newNone
variant has been added- Bevy's
bevy_gilrs
feature is now optional.- it is still enabled by leafwing-input-manager's default features.
- if you're using leafwing-input-manager with
default_features = false
, you can readd it by addingbevy/bevy_gilrs
as a dependency.
- removed
InputMap::build
method in favor of new fluent builder pattern (see 'Usability: InputMap' for details). - removed
DeadZoneShape
in favor of new dead zone processors (see 'Enhancements: Input Processors' for details). - refactored the fields and methods of
RawInputs
to fit the new input types. - removed
Direction
type in favor ofbevy::math::primitives::Direction2d
. - removed
MockInput::send_input
methods, in favor of new input mocking APIs (see 'Usability: MockInput' for details). DualAxisData
has been removed, and replaced with a simpleVec2
throughout- a new type with the
DualAxisData
name has been added, as a parallel toButtonData
andAxisData
- a new type with the
- when no
associated_gamepad
is provided to an input map,find_gamepad
will be called to attempt to search for a gamepad. Input from any gamepad will no longer work SummarizedActionState
is now found in theaction_diff
module- Axislike and DualAxislike inputs no longer send pressed / released
ActionDiff
s: onlyAxisChanged
andDualAxisChanged
events
- updated to Bevy 0.14
- this is strictly a compatibility release to ease migration; you should consider upgrading to version 0.15 when possible
- fixed a bug where
DualAxis
was being considered pressed even when its data was [0.0, 0.0].
- added
InputManagerBundle::with_map(InputMap)
allowing you to create the bundle with the givenInputMap
and defaultActionState
.
- added
with_threshold()
for constSingleAxis
creation. - added
horizontal_gamepad_face_buttons()
andvertical_gamepad_face_buttons()
forVirtualAxis
, similar toVirtualDpad::gamepad_face_buttons()
. - changed various creations of
DualAxis
,VirtualAxis
,VirtualDpad
into const functions as they should be:left_stick()
,right_stick()
forDualAxis
.from_keys()
,horizontal_arrow_keys()
,vertical_arrow_keys()
,ad()
,ws()
,horizontal_dpad()
,vertical_dpad()
forVirtualAxis
.arrow_keys()
,wasd()
,dpad()
,gamepad_face_buttons()
,mouse_wheel()
,mouse_motion()
forVirtualDpad
.
- removed the
block_ui_interactions
feature:- by default, this library will prioritize
bevy::ui
. - if you want to disable this priority, add the newly added
no_ui_priority
feature to your configuration.
- by default, this library will prioritize
- fixed a bug related to missing handling for
ActionState::consumed
- exported
ActionState::action_data_mut_or_default()
Modifier::Win
has been renamed toModifier::Super
, consistent withKeyCode::SuperLeft
andKeyCode::SuperRight
.- both
KeyCode
-based logical keybindings andScanCode
-based physical keybindings are no longer supported; please migrate to:KeyCode
s are now representing physical keybindings.InputKind::Keyboard
has been removed.InputKind::KeyLocation
has been removed; please useInputKind::PhysicalKey
instead.- All
ScanCode
s andQwertyScanCode
s have been removed; please useKeyCode
instead:- all letter keys now follow the format
KeyCode::Key<Letter>
, e.g.,ScanCode::K
is nowKeyCode::KeyK
. - all number keys over letters now follow the format
KeyCode::Digit<Number>
, e.g.,ScanCode::Key1
is nowKeyCode::Digit1
. - all arrow keys now follow the format
KeyCode::Arrow<Direction>
, e.g.,ScanCode::Up
is nowKeyCode::ArrowUp
.
- all letter keys now follow the format
bevy
dependency has been bumped from 0.12 to 0.13.bevy_egui
dependency has been bumped from 0.24 to 0.25.
- added a table detailing supported Bevy versions in the README.md
- added a feature flag
asset
allowing optionalbevy::asset::Asset
derive for theInputMap
- exported
InputKind
inprelude
module
- fixed compilation issues with no-default-features
- fixed a bug related to incorrect updating of
ActionState
.
- improved deadzone handling for both
DualAxis
andSingleAxis
deadzones- all deadzones now scale the input so that it is continuous.
DeadZoneShape::Cross
handles each axis separately, making a per-axis "snapping" effect- an input that falls on the exact boundary of a deadzone is now considered inside it
- added support in
ActionDiff
for value and axis_pair changes
InputMap
s are now constructed with(Action, Input)
pairs, rather than(Input, Action)
pairs, which directly matches the underlying data model- registered types in the reflection system
- added
InputMap::clear
- added
ActionState::keys
- exported
VirtualAxis
inprelude
module
- registered types in the reflection system
- added
InputMap::clear
- fixed a bug related to incorrect axis data in
Chord
when not all buttons are pressed.
- all non-insertion methods now take
&A: Actionlike
rather thanA: Actionlike
to avoid pointless cloning - removed
multimap
dependency in favor of regularHashMap
which allowed to deriveReflect
forInputMap
- removed widely unused and untested dynamic actions functionality: this should be more feasible to implement directly with the changed architecture
- removed widely unused
PressScheduler
functionality: this can be re-implemented externally ActionState
now stores aHashMap
internallyActionState::update
now takes aHashMap<A, ActionState>
rather than relying on orderingInputMap::which_pressed
now returns aHashMap<A, ActionState>
handle_clashes
now takes aHashMap<A, ActionState>
ClashStrategy::UseActionOrder
has been removed
- the
action_state
module has been pared down to something more reasonable in scope:- timing-related code now lives in its own
timing
module ActionStateDriver
code now lives in its ownaction_driver
moduleActionDiff
-related code now lives in its ownaction_diff
module
- timing-related code now lives in its own
- fixed a bug with mouse motion and mouse wheel events being improperly counted
- this was pre-existing, but dramatically worsened by the release of Bevy 0.12.1
bevy_egui
integration and theegui
feature flag have been added back with the release ofbevy_egui
0.23.
- A disabled
ToggleActions
of oneAction
now does not release otherAction
's inputs. bevy_egui
integration and theegui
feature flag have been added back with the release ofbevy_egui
0.23.
bevy_egui
integration and theegui
feature flag have been temporarily removed to ensure a timely release- gamepad input mocking is not completely functional due to upstream changes: see #407
- additional experiments and information would be helpful!
- The
UserInput::insert_at
method has been removed: build this abstraction into your input binding menus if desired. InputMap::iter()
now returns a simple iterator of (action, input) pairs- As a result, the
InputMap::iter_inputs
method has been removed.
- As a result, the
- The
InputMap::remove_at
API now returnsSome(removed_input)
, rather than just abool
. - The serialization format for
InputMap
has changed. You will need to re-generate your input maps if you were storing these persistently.
- Added
DeadZoneShape
forDualAxis
which allows for different deadzones shapes: cross, rectangle, and ellipse. - Added sensitivity for
SingleAxis
andDualAxis
, allowing you to scale mouse, keypad and gamepad inputs differently for each action. - Added a helper
from_keys
toVirtualAxis
to simplify creating one from two keys
- Added
block_ui_interactions
feature flag; when on, mouse input won't be read if anybevy_ui
element has an activeInteraction
. - Chords no longer have a max length.
InputMap
,UserInput
and all of the contained types now implementReflect
. As a result, the trait bound onActionlike
has been changed fromTypePath
toReflect
.
- Fixed system order ambiguity between bevy_ui and update_action_state systems
- The input values of axis inputs in a
Chord
are now prioritized over buttons - Fixed unassigned
InputMaps
s not receiving input from all connected gamepads
- Removed the
petitset
dependency in favor of aMultiMap
to reduce stack size of input types.- As a result, the
Actionlike
trait now has the additionalHash
andEq
trait bounds UserInput::Chord
now stores a simpleVec
ofInputKind
s
- As a result, the
- Fixed invalid example code in README
- Added example for setting default controls
- Added example for registering gamepads in a local multiplayer fashion
bevy
dependency has been bumped from 0.10 to 0.11.ActionLike
now requires Bevy'sTypePath
trait. Your actions will now need to deriveReflect
orTypePath
. See bevy#7184QwertyScanCode
has had its variants renamed to match bevy'sKeyCode
variants. See bevy#8792- Makes
run_if_enabled
public.
- Changed
entity
field ofActionStateDriver
totargets: ActionStateDriverTarget
with variants for 0, 1, or multiple targets, to allow for one driver to update multiple entities if needed. - Added builder-style functions to
SingleAxis
,DualAxis
, andVirtualDPad
that invert their output values, allowing, for example, binding inverted camera controls.
- Added example for driving cursor position action from another entity.
- Changed
Rotation
to be stored in millionths of a degree instead of tenths of a degree in order to reduce rounding errors.
- Added
VirtualAxis::horizontal_dpad()
andVirtualAxis::vertical_dpad()
. - Do not read mouse input if any
bevy_ui
element have activeInteraction
.
- Fixed
DualAxis
inputs so deadzones apply across both axes, and filter out-of-range values correctly.
- Added common run conditions for actions that mirrors input conditions in Bevy.
- Added
ActionState::consume_all()
to consume all actions. bevy_egui
dependency has been bumped from 0.19 to 0.20.bevy
dependency has been bumped from 0.9 to 0.10.
- Added scan code support, which enables you to define keybindings depending on the key position rather than the key output.
This is useful to make the keybindings layout-independent and is commonly used for the WASD movement controls.
- Use
ScanCode
to define the raw scan code values. - Use
QwertyScanCode
to define the scan code by the name of the key on the US QWERTY keyboard layout.
- Use
- The
Actionlike::N_VARIANTS
constant has been changed to a function. - Added the
DynAction
type and various companions to enable more advanced use cases.
bevy_egui
dependency has been bumped from 0.18 to 0.19.
- Added custom implementation of the
Serialize
andDeserialize
traits forInputMap
to make the format more human readable. - Added
TypeUuid
forInputMap
to be able use it as asset without wrapper ActionState
and its fields now implementReflect
. The type is automatically registered when theInputManagerPlugin
is added.- Added
PressScheduler
, used to defer action presses until the start of the next frame to ease scheduling.
egui
feature now works correctly and more robustly if anEguiPlugin
is not actually enabled.
- Added
VirtualAxis
struct that can be supplied to anInputMap
to trigger on two direction-representing inputs. 1-dimensional equivalent toVirtualDPad
.
- Added
egui
feature to not take specific input sources into account when egui is using them. For example, when the user clicks on a widget, the actions associated with the mouse will not be taken into account. InputStreams
no longer stores anOption
to an input stream type: all fields other thanassociated_gamepad
are now required. This was not useful in practice and added significant complexity.
- no longer print "real clash" due to a missed debugging statement
- Added the
Modifier
enum, to ergonomically capture the notion of "either control/alt/shift/windows key".- The corresponding
InputKind::Modifier
variant was added to match. - You can conveniently construct these using the
InputKind::modified
orInputMap::insert_modified
methods.
- The corresponding
- Implemented
Eq
forTiming
andInputMap
. - Held
ActionState
inputs will now be released when anInputMap
is removed. - Improve
ToggleActions
.- Make
_phantom
field public and rename intophantom
. - Add
ToggleActions::ENABLED
andToggleActions::DISABLED
.
- Make
- Added
SingleAxis::negative_only
andSingleAxis::positive_only
for triggering separate actions for each direction of an axis. ActionData::action_data
now returns a reference, rather than a clone, for consistency and explicitness- added
with_deadzone
methods to configure the deadzones for bothSingleAxis
andDualAxis
inputs
- Fixed gamepad axes not filtering out inputs outside of the axis deadzone.
- Fixed
DualAxis::right_stick()
returning the y axis for the left stick.
- removed a missed
println
statement spamming "real conflict" that had been missed
- Added gamepad axis support.
- Use the new
SingleAxis
andDualAxis
types / variants.
- Use the new
- Added mousewheel and mouse motion support.
- Use the new
SingleAxis
andDualAxis
types / variants when you care about the continuous values. - Use the new
MouseWheelDirection
enum as anInputKind
.
- Use the new
- Added
SingleAxis
andDualAxis
structs that can be supplied to anInputMap
to trigger on axis inputs. - Added
VirtualDPad
struct that can be supplied to anInputMap
to trigger on four direction-representing inputs. - Added
ActionState::action_axis_pair()
which can return anAxisPair
containing the analog values of aSingleAxis
,DualAxis
, orVirtualDPad
. - Added
ActionState::action_value()
which represents the floating point value of any action:1.0
or0.0
for pressed or unpressed button-like inputs- a value (typically) in the range
-1.0..=1.0
for a single axis representing its analog input - or a value (typically) in the range
0.0..=1.0
for a dual axis representing the magnitude (length) of its vector.
- If no gamepad is registered to a specific
InputMap
, inputs from any gamepad in theGamepads
resource will be used. - Removed the
ActionState::reasons_pressed
API.- This API was quite complex, not terribly useful and had nontrivial performance overhead.
- This was not needed for axislike inputs in the end.
- Added
Direction::try_new()
to fallibly create a newDirection
struct (which cannot be created from the zero vector). - Removed the
InputMode
enum.- This was poorly motivated and had no internal usages.
- This could not accurately represent more complex compound input types.
ButtonKind
was renamed toInputKind
to reflect the new non-button input types.- Renamed
AxisPair
toDualAxisData
.Vec2::new
now takes twof32
values for ergonomic reasons.- Use
DualAxisData::from_xy
to construct this directly from aVec2
as before.
- Rotation is now measured from the positive x axis in a counterclockwise direction. This applies to both
Rotation
andDirection
.- This increases consistency with
glam
and makes trigonometry easier.
- This increases consistency with
- Added
Direction::try_from
which never panics; consider using this in place ofDirection::new
. - Converting from a
Direction
(which uses aVec2
off32
's internally) to aRotation
(which uses exact decidegrees) now has special cases to ensure all eight cardinal directions result in exact degrees.- For example, a unit vector pointing to the Northeast now always converts to a
Direction
with exactly 1350 decidegrees. - Rounding errors may still occur when converting from arbitrary directions to the other 3592 discrete decidegrees.
- For example, a unit vector pointing to the Northeast now always converts to a
InputStreams
andMutableInputStreams
no longer store e.g.Option<Res<Input<MouseButton>>>
, and instead simply storeRes<Input<MouseButton>>
- This makes them much easier to work with and dramatically simplifies internal logic.
InputStreams::from_world
no longer requires&mut World
, as it does not require mutable access to any resources.- Renamed
InputMocking::send_input_to_gamepad
andInputMocking::release_input_for_gamepad
toInputMocking::send_input_as_gamepad
andInputMocking::send_input_as_gamepad
. - Added the
guess_gamepad
method toInputStreams
andMutableInputStreams
, which attempts to find an appropriate gamepad to use. InputMocking::pressed
andpressed_for_gamepad
no longer require&mut self
.UserInput::raw_inputs
now returns aRawInputs
struct, rather than a tuple struct.- The
mouse
andkeyboard
fields on the twoInputStreams
types are now namedmouse_button
andkeycode
respectively.
- mocked inputs are now sent at the low-level
Events
form, rather than in theirInput
format.- this ensures that user code that is reading these events directly can be tested accurately.
- fixed a compilation error caused by mistakenly renaming the macros crate
- reduced required
derive_more
features - removed
thiserror
dependency - the order of all methods on
InputMap
is now(input, action)
, rather than(action, input
) to better match user mental models- this is a map-like struct: one presses
KeyCode::F
toActions::PayRespects
, not the other way around! - this includes the order of all paired tuples, including the returned values
- this is a map-like struct: one presses
- fixed serious bug that broke all functionality relating to durations that buttons were pressed or released for
ActionState::tick
now takes theInstant
of both the current and previous frame, rather than just the current
InputManagerPlugin
no longer panics when time does not have a previous update- this is useful as it ensures
bevy_inspector_egui
compatibility!
- this is useful as it ensures
- properly documented the
ToggleActions
functionality, for dynamically enabling and disabling actions - added doc examples to
ActionStateDriver
, which allows you to trigger actions based on entity properties - document the need to add system ordering when you have other functionality running during
CoreStage::PreUpdate
- hint to users that they may want to use multiple
Actionlike
enums
- added
reasons_pressed
API onActionState
, which records the triggering inputs- you can use this to extract exact input information from analog inputs (like triggers or joysticks)
- added the ability to release user inputs during input mocking
- added
ActionState::consume(action)
, which allows you to consume a pressed action, ensuring it is not pressed until after it is otherwise released - added geometric primitives (
Direction
andRotation
) for working with rotations in 2 dimensions- stay tuned for first-class directional input support!
- if desired, users are now able to use the
ActionState
andInputMap
structs as standalone resources - reverted change from by-reference to by-value APIs for
Actionlike
types- this is more ergonomic (derive
Copy
when you can!), and somewhat faster in the overwhelming majority of uses
- this is more ergonomic (derive
- relaxed
Hash
andEq
bounds onActionlike
InputManagerPlugin::run_in_state
was replaced withToggleActions<A: Actionlike>
resource which controls whether or not the [ActionState
] / [InputMap
] pairs of typeA
are active.ActionState::state
andset_state
methods renamed tobutton_state
andset_button_state
for clarity- simplified
VirtualButtonState
into a trivial enumButtonState
- other metadata (e.g. timing information and reasons pressed) is stored in the
ActionData
struct - users can now access the
ActionData
struct directly for each action in aActionState
struct, allowing full manual control for unusual needs
- other metadata (e.g. timing information and reasons pressed) is stored in the
- removed a layer of indirection for fetching timing information: simply call
action_state.current_duration(&Action::Jump)
, rather thanaction_state.button_state(Action::Jump).current_duration()
- fleshed out
ButtonState
API for better parity withActionState
- removed
UserInput::Null
: this was never helpful and bloated match statements- insert this resource when you want to suppress input collection, and remove it when you're done
- renamed the
InputManagerSystem::Reset
system label toInputManagerSystem::Tick
. - refactored
InputMap
- removed methods that works with specific input mode.
- removed
n_registered
, useget(action).len()
instead. - added
insert_at
/remove_at
to insert / remove input at specific index. - added
remove
remove input for specific mapping. - use
usize
for sizes as in other Rust containers.
- added
UserInput::raw_inputs
, which breaks down aUserInput
into the constituent Bevy types (e.g.KeyCode
andMouseButton
)
- the
PartialOrd
implementation ofTiming
now correctly compares values on the basis of the current duration that the button has been held / released for
- configure how "clashing" inputs should be handled with the
ClashStrategy
field of yourInputMap
- very useful for working with modifier keys
- if two actions are triggered
- ergonomic input mocking API at both the
App
andWorld
level using theMockInputs
trait - send
ActionState
across the network in a space-efficient fashion using theActionDiff
struct- check out (or directly use) the
process_action_diff
andgenerate_action_diff
systems to convert these to and fromActionStates
- add
InputManagerPlugin::server()
to your serverApp
for a stripped down version of the input management functionality
- check out (or directly use) the
InputMap::new()
andInputMap::insert_multiple
now accept an iterator of(action, input)
tuples for more natural construction- better decoupled
InputMap
andActionState
, providing anInputMap::which_pressed
API and allowingActionState::update
to operate based on anyHashSet<A: Actionlike>
of pressed virtual buttons that you pass in InputMap
now uses a collectedInputStreams
struct in all of its methods, and input methods are now optionalInputManagerPlugin
now works even if some input stream resources are missing- added the
input_pressed
method toInputMap
, to check if a single input is pressed - renamed
InputMap::assign_gamepad
toInputMap::set_gamepad
for consistency and clarity (it does not uniquely assign a gamepad) - removed
strum
dependency by reimplementing the functionality, allowing users to define actions with only theActionlike
trait - added the
get_at
andindex
methods on theActionlike
trait, allowing you to fetch a specific action by its position in the defining enum and vice versa Copy
bound onActionlike
trait relaxed toClone
, allowing you to store non-copy data in your enum variantsClone
,PartialEq
andDebug
trait impls forActionState
get_pressed
,get_just_pressed
,get_released
andget_just_released
methods onActionState
, for conveniently checking many action states at once
- the
ActionState
component is no longer marked asChanged
every frame InputManagerPlugin::run_in_state
now actually works!- virtually all methods now take actions and inputs by reference, rather than by ownership, eliminating unnecessary copies
- added
set_state
method, allowing users to transferVirtualButtonState
betweenActionState
without losingTiming
information
- fixed minor mistakes in documentation
- fix failed
strum
re-export; users will need to pull in the derive macroEnumIter
themselves- thanks to
@Shatur
for noticing this
- thanks to
- Released!