#include <InputDevice.h>
Inherits InputDeviceRequestBus::Handler, and ApplicationLifecycleEvents::Bus::Handler.
Inherited by AzFramework::InputContext, AzFramework::InputDeviceGamepad, AzFramework::InputDeviceKeyboard, AzFramework::InputDeviceMotion, AzFramework::InputDeviceMouse, AzFramework::InputDeviceTouch, and AzFramework::InputDeviceVirtualKeyboard.
Public Member Functions | |
AZ_CLASS_ALLOCATOR (InputDevice, AZ::SystemAllocator) | |
AZ_RTTI (InputDevice, "{29F9FB6B-15CB-4DB4-9F36-DE7396B82F3D}") | |
InputDevice (const InputDeviceId &inputDeviceId) | |
AZ_DISABLE_COPY_MOVE (InputDevice) | |
~InputDevice () override | |
Destructor. | |
const InputDevice * | GetInputDevice () const final |
AzFramework::InputDeviceRequests::GetInputDevice | |
const InputDeviceId & | GetInputDeviceId () const |
virtual LocalUserId | GetAssignedLocalUserId () const |
virtual void | PromptLocalUserSignIn () const |
virtual const InputChannelByIdMap & | GetInputChannelsById () const =0 |
virtual bool | IsSupported () const =0 |
virtual bool | IsConnected () const =0 |
Static Public Member Functions | |
static void | Reflect (AZ::ReflectContext *context) |
Protected Member Functions | |
void | BroadcastInputChannelEvent (const InputChannel &inputChannel) const |
void | BroadcastInputTextEvent (const AZStd::string &textUTF8) const |
void | BroadcastInputDeviceConnectedEvent () const |
Broadcast an event when the input device connects to the system. | |
void | BroadcastInputDeviceDisconnectedEvent () const |
Broadcast an event when the input device disconnects from the system. | |
void | ResetInputChannelStates () |
Reset the state of all this input device's associated input channels. | |
Base class for all input devices. Input devices are responsible for processing raw input and using it to update their associated input channels. Input devices can also be queried at any time to determine their current connected state, or retrieve their associated input channels.
While almost every concrete input device that inherits from this class will likely only send input events when running on a specific platform, we should always be able to access all the potentially available input devices and channels in order to display and set input bindings.
Derived classes are responsible for:
Ideally, an input device will use TickInputDevice (that gets called once every frame by the system) to process raw input, update all its input channels, and broadcast all input events. However, this may not always be possible, as the state of an input channel cannot always be queried at will, but will rather be sent by the system at a pre-determined time (eg. touch). In these cases, input devices must queue all raw input until TickInputDevice is called, when they can use it to update their input channels and broadcast events at the appropriate time.
|
explicit |
Constructor
[in] | inputDeviceId | Id of the input device |
|
protected |
Broadcast an event when an associated input channel's state or value is updated
[in] | inputChannel | The input channel whose state or value was updated |
|
protected |
Broadcast an event when unicode text input is generated by an input device
[in] | textUTF8 | The text emitted by the input device (encoded using UTF-8) |
|
virtual |
Access to the input device's currently assigned local user id. By default this returns the device index, but can be overridden to return a platform specific user id in order to support platforms where input comes from a specific user rather than just an index. Values are guaranteed to be unique for the local system, but they are otherwise system dependent and a user id may not necessarily persist for the same user between app runs.
Reimplemented in AzFramework::InputDeviceGamepad, AzFramework::InputDeviceKeyboard, and AzFramework::InputDeviceTouch.
|
pure virtual |
Access to all input channels associated with this input device
Implemented in AzFramework::InputContext, AzFramework::InputDeviceGamepad, AzFramework::InputDeviceKeyboard, AzFramework::InputDeviceMotion, AzFramework::InputDeviceMouse, AzFramework::InputDeviceTouch, and AzFramework::InputDeviceVirtualKeyboard.
const InputDeviceId & AzFramework::InputDevice::GetInputDeviceId | ( | ) | const |
Access to the input device's id
|
pure virtual |
Query whether the device is currently connected to the system. A device can be supported but not currently connected, while a currently connected device will always be supported.
Implemented in AzFramework::InputContext, AzFramework::InputDeviceGamepad, AzFramework::InputDeviceKeyboard, AzFramework::InputDeviceMotion, AzFramework::InputDeviceMouse, AzFramework::InputDeviceTouch, and AzFramework::InputDeviceVirtualKeyboard.
|
pure virtual |
Query whether the device is supported by the current platform. A device can be supported but not currently connected, while a currently connected device will always be supported.
Implemented in AzFramework::InputContext, AzFramework::InputDeviceGamepad, AzFramework::InputDeviceKeyboard, AzFramework::InputDeviceMotion, AzFramework::InputDeviceMouse, AzFramework::InputDeviceTouch, and AzFramework::InputDeviceVirtualKeyboard.
|
inlinevirtual |
Prompt a platform-specific local user sign-in request from this device. Should be called at the appropriate times (eg. start screen, local multiplayer lobby / join screen) where input is detected from a specific input device that does not yet have a user id assigned.
Please note that on most platforms this will do nothing, and even on platforms where it does it cannot be assumed that the sign-in flow will actually be completed by the user.
Reimplemented in AzFramework::InputDeviceGamepad.