- Added custom implementation of the
SerializeandDeserializetraits forInputMapto make the format more human readable. - Added
TypeUuidforInputMapto be able use it as asset without wrapper ActionStateand its fields now implementReflect. The type is automatically registered when theInputManagerPluginis added.
eguifeature now works correctly and more robustly if anEguiPluginis not actually enabled.
- Added
VirtualAxisstruct that can be supplied to anInputMapto trigger on two direction-representing inputs. 1-dimensional equivalent toVirtualDPad.
- Added
eguifeature 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. InputStreamsno longer stores anOptionto an input stream type: all fields other thanassociated_gamepadare 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
Modifierenum, to ergonomically capture the notion of "either control/alt/shift/windows key".- The corresponding
InputKind::Modifiervariant was added to match. - You can conveniently construct these using the
InputKind::modifiedorInputMap::insert_modifiedmethods.
- The corresponding
- Implemented
EqforTimingandInputMap. - Held
ActionStateinputs will now be released when anInputMapis removed. - Improve
ToggleActions.- Make
_phantomfield public and rename intophantom. - Add
ToggleActions::ENABLEDandToggleActions::DISABLED.
- Make
- Added
SingleAxis::negative_onlyandSingleAxis::positive_onlyfor triggering separate actions for each direction of an axis. ActionData::action_datanow returns a reference, rather than a clone, for consistency and explicitness- added
with_deadzonemethods to configure the deadzones for bothSingleAxisandDualAxisinputs
- 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
printlnstatement spamming "real conflict" that had been missed
- Added gamepad axis support.
- Use the new
SingleAxisandDualAxistypes / variants.
- Use the new
- Added mousewheel and mouse motion support.
- Use the new
SingleAxisandDualAxistypes / variants when you care about the continous values. - Use the new
MouseWheelDirectionenum as anInputKind.
- Use the new
- Added
SingleAxisandDualAxisstructs that can be supplied to anInputMapto trigger on axis inputs. - Added
VirtualDPadstruct that can be supplied to anInputMapto trigger on four direction-representing inputs. - Added
ActionState::action_axis_pair()which can return anAxisPaircontaining the analog values of aSingleAxis,DualAxis, orVirtualDPad. - Added
ActionState::action_value()which represents the floating point value of any action:1.0or0.0for pressed or unpressed button-like inputs- a value (typically) in the range
-1.0..=1.0for a single axis representing its analog input - or a value (typically) in the range
0.0..=1.0for a dual axis representing the magnitude (length) of its vector.
- If no gamepad is registered to a specific
InputMap, inputs from any gamepad in theGamepadsresource will be used. - Removed the
ActionState::reasons_pressedAPI.- 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 newDirectionstruct (which cannot be created from the zero vector). - Removed the
InputModeenum.- This was poorly motivated and had no internal usages.
- This could not accurately represent more complex compound input types.
ButtonKindwas renamed toInputKindto reflect the new non-button input types.- Renamed
AxisPairtoDualAxisData.DualAxisData::newnow takes twof32values for ergonomic reasons.- Use
DualAxisData::from_xyto construct this directly from aVec2as before.
- Rotation is now measured from the positive x axis in a counterclockwise direction. This applies to both
RotationandDirection.- This increases consistency with
glamand makes trigonometry easier.
- This increases consistency with
- Added
Direction::try_fromwhich never panics; consider using this in place ofDirection::new. - Converting from a
Direction(which uses aVec2off32'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
Directionwith 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
InputStreamsandMutableInputStreamsno 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_worldno longer requires&mut World, as it does not require mutable access to any resources.- Renamed
InputMocking::send_input_to_gamepadandInputMocking::release_input_for_gamepadtoInputMocking::send_input_as_gamepadandInputMocking::send_input_as_gamepad. - Added the
guess_gamepadmethod toInputStreamsandMutableInputStreams, which attempts to find an appropriate gamepad to use. InputMocking::pressedandpressed_for_gamepadno longer require&mut self.UserInput::raw_inputsnow returns aRawInputsstruct, rather than a tuple struct.- The
mouseandkeyboardfields on the twoInputStreamstypes are now namedmouse_buttonandkeycoderespectively.
- mocked inputs are now sent at the low-level
Eventsform, rather than in theirInputformat.- 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_morefeatures - removed
thiserrordependency - the order of all methods on
InputMapis now(input, action), rather than(action, input) to better match user mental models- this is a map-like struct: one presses
KeyCode::FtoActions::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::ticknow takes theInstantof both the current and previous frame, rather than just the current
InputManagerPluginno longer panics when time does not have a previous update- this is useful as it ensures
bevy_inspector_eguicompatibility!
- this is useful as it ensures
- properly documented the
ToggleActionsfunctionality, 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
Actionlikeenums
- added
reasons_pressedAPI 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 (
DirectionandRotation) for working with rotations in 2 dimensions- stay tuned for first-class directional input support!
- if desired, users are now able to use the
ActionStateandInputMapstructs as standalone resources - reverted change from by-reference to by-value APIs for
Actionliketypes- this is more ergonomic (derive
Copywhen you can!), and somewhat faster in the overwhelming majority of uses
- this is more ergonomic (derive
- relaxed
HashandEqbounds onActionlike InputManagerPlugin::run_in_statewas replaced withToggleActions<A: Actionlike>resource which controls whether or not the [ActionState] / [InputMap] pairs of typeAare active.ActionState::stateandset_statemethods renamed tobutton_stateandset_button_statefor clarity- simplified
VirtualButtonStateinto a trivial enumButtonState- other metadata (e.g. timing information and reasons pressed) is stored in the
ActionDatastruct - users can now access the
ActionDatastruct directly for each action in aActionStatestruct, 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
ButtonStateAPI 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::Resetsystem label toInputManagerSystem::Tick. - refactored
InputMap- removed methods that works with specific input mode.
- removed
n_registered, useget(action).len()instead. - added
insert_at/remove_atto insert / remove input at specific index. - added
removeremove input for specific mapping. - use
usizefor sizes as in other Rust containers.
- added
UserInput::raw_inputs, which breaks down aUserInputinto the constituent Bevy types (e.g.KeyCodeandMouseButton)
- the
PartialOrdimplementation ofTimingnow 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
ClashStrategyfield of yourInputMap- very useful for working with modifier keys
- if two actions are triggered
- ergonomic input mocking API at both the
AppandWorldlevel using theMockInputstrait - send
ActionStateacross the network in a space-efficient fashion using theActionDiffstruct- check out (or directly use) the
process_action_diffandgenerate_action_diffsystems to convert these to and fromActionStates - add
InputManagerPlugin::server()to your serverAppfor a stripped down version of the input management functionality
- check out (or directly use) the
InputMap::new()andInputMap::insert_multiplenow accept an iterator of(action, input)tuples for more natural construction- better decoupled
InputMapandActionState, providing anInputMap::which_pressedAPI and allowingActionState::updateto operate based on anyHashSet<A: Actionlike>of pressed virtual buttons that you pass in InputMapnow uses a collectedInputStreamsstruct in all of its methods, and input methods are now optionalInputManagerPluginnow works even if some input stream resources are missing- added the
input_pressedmethod toInputMap, to check if a single input is pressed - renamed
InputMap::assign_gamepadtoInputMap::set_gamepadfor consistency and clarity (it does not uniquely assign a gamepad) - removed
strumdependency by reimplementing the funcitonality, allowing users to define actions with only theActionliketrait - added the
get_atandindexmethods on theActionliketrait, allowing you to fetch a specific action by its position in the defining enum and vice versa Copybound onActionliketrait relaxed toClone, allowing you to store non-copy data in your enum variantsClone,PartialEqandDebugtrait impls forActionStateget_pressed,get_just_pressed,get_releasedandget_just_releasedmethods onActionState, for conveniently checking many action states at once
- the
ActionStatecomponent is no longer marked asChangedevery frame InputManagerPlugin::run_in_statenow actually works!- virtually all methods now take actions and inputs by reference, rather than by ownership, eliminating unneccesary copies
- added
set_statemethod, allowing users to transferVirtualButtonStatebetweenActionStatewithout losingTiminginformation
- fixed minor mistakes in documentation
- fix failed
strumre-export; users will need to pull in the derive macroEnumIterthemselves- thanks to
@Shaturfor noticing this
- thanks to
- Released!