![]() |
ezEngine Release 26.9
|
A synthetic input device that writes whatever an agent tells it to. More...
#include <McpInputDevice.h>

Classes | |
| struct | HeldSlot |
| What this device is currently writing, and for how much longer. More... | |
Public Member Functions | |
| void | SetSlotValue (ezStringView sSlot, float fValue, ezUInt32 uiFrames) |
| Sets a slot's value, held until it is changed again or cleared. | |
| void | ClearSlot (ezStringView sSlot) |
| Stops writing a slot entirely. Anything else writing it is then the only source again. | |
| void | ClearAllSlots () |
| Stops writing every slot. | |
| void | QueueText (ezStringView sText) |
| Injects typed text in one call, as if the OS had delivered every character within the same frame. | |
| void | GetHeldSlots (ezDynamicArray< HeldSlot > &out_slots) const |
Public Member Functions inherited from ezInputDevice | |
| ezInputDevice () | |
| Default Constructor. | |
| float | GetInputSlotState (ezStringView sSlot) const |
| Allows to query current input values for the given slot. | |
| bool | HasDeviceBeenUsedLastFrame () const |
| Returns true, if the device was 'used' during the last frame, ie. when it generated input due to some user interaction. | |
Public Member Functions inherited from ezReflectedClass | |
| virtual const ezRTTI * | GetDynamicRTTI () const |
| bool | IsInstanceOf (const ezRTTI *pType) const |
| Returns whether the type of this instance is of the given type or derived from it. | |
| template<typename T > | |
| EZ_ALWAYS_INLINE bool | IsInstanceOf () const |
| Returns whether the type of this instance is of the given type or derived from it. | |
Static Public Member Functions | |
| static ezMcpInputDevice * | GetInstance () |
| The one instance, or nullptr while the plugin's input tool does not exist. | |
Static Public Member Functions inherited from ezNoBase | |
| static const ezRTTI * | GetStaticRTTI () |
Private Member Functions | |
| virtual void | InitializeDevice () override |
| Override this if you need to do device specific initialization before the first use. | |
| virtual void | RegisterInputSlots () override |
| Override this to register all the input slots that this device exposes. | |
| virtual void | UpdateInputSlotValues () override |
| Override this, if you need to query the state of the hardware to update the input slots. | |
Additional Inherited Members | |
Protected Member Functions inherited from ezInputDevice | |
| virtual void | ResetInputSlotValues () |
| Override this, if you need to reset certain input slot values to zero, after the ezInputManager is finished with the current frame update. | |
| virtual void | UpdateHardwareState (ezTime tTimeDifference) |
| This function is called once after ezInputManager::Update with the same time delta value. It allows to update hardware state, such as the vibration of gamepad motors. | |
Static Protected Member Functions inherited from ezInputDevice | |
| static void | RegisterInputSlot (ezStringView sName, ezStringView sDefaultDisplayName, ezBitflags< ezInputSlotFlags > SlotFlags) |
| Calls RegisterInputSlot() on the ezInputManager and passes the parameters through. | |
Protected Attributes inherited from ezInputDevice | |
| bool | m_bOverridesAbsoluteInput = false |
| Whether this device is authoritative for absolute-value slots (a position, not a delta) it writes, such as the mouse position - see ezInputManager::GatherDeviceInputSlotValues(). | |
| ezMap< ezString, float > | m_InputSlotValues |
| Stores all the values for all input slots that this device handles. | |
| ezStringBuilder | m_sLastCharacters |
| If this input device type handles character input, append every typed character (Unicode codepoint) it receives to this, one Append() call per character event. Append rather than overwrite, so several characters typed within one frame - which happens whenever the OS delivers input faster than the game updates - are all preserved instead of all but the last being silently dropped. The ezInputManager calls RetrieveLastCharacters() to query what the user typed since the last update. | |
Protected Attributes inherited from ezEnumerable< ezInputDevice, ezReflectedClass > | |
| ezEnumerable * | m_pNextInstance |
A synthetic input device that writes whatever an agent tells it to.
A real ezInputDevice rather than ezInputManager::InjectInputSlotValue(), for three reasons that all fall out of how the manager works:
It registers no slots of its own. It writes the names that the real devices already registered - 'keyboard_w', 'mouse_button_0' - which is what makes the Max merge meaningful in the first place. A slot nobody registered can still be written, it just never reaches anything that reads input.
The header of ezInputDevice warns that a device may need integration into window message handling. That applies to hardware; there is no hardware here.
|
inlineoverrideprivatevirtual |
Override this if you need to do device specific initialization before the first use.
Implements ezInputDevice.
| void ezMcpInputDevice::QueueText | ( | ezStringView | sText | ) |
Injects typed text in one call, as if the OS had delivered every character within the same frame.
Unlike SetSlotValue(), this is not held: it is consumed the next time something reads ezInputManager::RetrieveLastCharacters() - same as a real keystroke - and gone afterwards. Queuing again before that happens appends, it does not replace.
|
inlineoverrideprivatevirtual |
Override this to register all the input slots that this device exposes.
This is called once during initialization. It needs to call RegisterInputSlot() once for every input slot that this device exposes to the system.
Implements ezInputDevice.
| void ezMcpInputDevice::SetSlotValue | ( | ezStringView | sSlot, |
| float | fValue, | ||
| ezUInt32 | uiFrames | ||
| ) |
Sets a slot's value, held until it is changed again or cleared.
| uiFrames | How many frames to hold it for, counted down once per input update. 0 means indefinitely - which is what a caller who wants to press a key now and release it later wants, and also the way to leave a movement axis held down. |
|
overrideprivatevirtual |
Override this, if you need to query the state of the hardware to update the input slots.
Implements ezInputDevice.