![]() |
ezEngine
Release 25.03
|
A struct that defines how to register an input action. More...
#include <InputManager.h>
Public Types | |
enum | { MaxInputSlotAlternatives = 3 } |
Change this value to adjust how many input slots may trigger the same action. | |
enum | OnLeaveArea { LoseFocus, KeepFocus } |
For Input Areas: Describes what happens when an action is currently triggered, but the input slots used for filtering leave their min/max values. More... | |
enum | OnEnterArea { ActivateImmediately, RequireKeyUp } |
For Input Areas: Describes what happens when any trigger slot is already active will the input slots that are used for filtering enter the valid ranges. More... | |
Public Attributes | |
bool | m_bApplyTimeScaling |
If this is set to true, the value of the action is scaled by the time difference since the last input update. Default is true. More... | |
ezString | m_sInputSlotTrigger [MaxInputSlotAlternatives] |
Which input slots will trigger this action. | |
float | m_fInputSlotScale [MaxInputSlotAlternatives] |
This scale is applied to the input slot value (before time scaling). Positive values mean a linear scaling, negative values an exponential scaling (i.e SlotValue = ezMath::Pow(SlotValue, -ScaleValue)). Default is 1.0f. | |
ezString | m_sFilterByInputSlotX [MaxInputSlotAlternatives] |
For Input Areas: If this is set, the input slot with the given name must have a value between m_fFilterXMinValue and m_fFilterXMaxValue. Otherwise this action will not be triggered. | |
ezString | m_sFilterByInputSlotY [MaxInputSlotAlternatives] |
For Input Areas: If this is set, the input slot with the given name must have a value between m_fFilterYMinValue and m_fFilterYMaxValue. Otherwise this action will not be triggered. | |
float | m_fFilterXMinValue |
=0; see m_sFilterByInputSlotX | |
float | m_fFilterXMaxValue |
=1; see m_sFilterByInputSlotX | |
float | m_fFilterYMinValue |
=0; see m_sFilterByInputSlotY | |
float | m_fFilterYMaxValue |
=1; see m_sFilterByInputSlotY | |
float | m_fFilteredPriority |
OnLeaveArea | m_OnLeaveArea |
=LoseFocus | |
OnEnterArea | m_OnEnterArea |
=ActivateImmediately | |
A struct that defines how to register an input action.
For Input Areas: Describes what happens when any trigger slot is already active will the input slots that are used for filtering enter the valid ranges.
Enumerator | |
---|---|
ActivateImmediately | The input action will immediately get activated and return ezKeyState::Pressed, even though the input slots are already pressed for some time. |
RequireKeyUp | The input action will not get triggered, unless some trigger input slot is actually pressed while the input slots that are used for filtering are actually within valid ranges. |
For Input Areas: Describes what happens when an action is currently triggered, but the input slots used for filtering leave their min/max values.
Enumerator | |
---|---|
LoseFocus | The input action will lose focus and thus get 'deactivated' immediately. Ie. it will return ezKeyState::Released. |
KeepFocus | The input action will keep focus and continue to return ezKeyState::Down, until all trigger slots are actually released. |
bool ezInputActionConfig::m_bApplyTimeScaling |
If this is set to true, the value of the action is scaled by the time difference since the last input update. Default is true.
You should enable this, if the value of the triggered action is used to modify how much to e.g. move or rotate something. For example, if an action 'RotateLeft' will rotate the player to the left, then he should rotate each frame an amount that is dependent on how much time has passed since the last update and by how much the button is pressed (e.g. a thumb-stick can be pressed only slightly). Mouse input, however, should not get scaled, because when the user moved the mouse one centimeter in the last frame, then that is an absolute movement and it does not depend on how much time elapsed. Therefore the ezInputManager will take care NOT to scale input from such devices, whereas input from a thumb-stick or a keyboard key would be scaled by the elapsed time.
However, if you for example use a thumb-stick to position something on screen (e.g. a cursor), then that action should NEVER be scaled by the elapsed time, because you are actually interested in the absolute value of the thumb-stick (and thus the action). In such cases you should disable time scaling.
When you have an action where your are not interested in the value, only in whether it is triggered, at all, you can ignore time scaling altogether.
float ezInputActionConfig::m_fFilteredPriority |
=large negative value; For Input Areas: If two input actions overlap and they have different priorities, the one with the larger priority will be triggered. Otherwise both are triggered.