Open 3D Engine AzFramework API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzFramework::InputContext Class Reference

#include <InputContext.h>

Inherits AzFramework::InputDevice, and AzFramework::InputChannelEventListener.

Classes

struct  InitData
 Custom data struct used to initialize input contexts. More...
 

Public Member Functions

 AZ_CLASS_ALLOCATOR (InputContext, AZ::SystemAllocator)
 
 AZ_RTTI (InputContext, "{D17A85B2-405F-40AB-BBA7-F118256D39AB}", InputDevice)
 
 InputContext (const char *name)
 
 InputContext (const char *name, const InitData &initData)
 
 AZ_DISABLE_COPY_MOVE (InputContext)
 
 ~InputContext () override
 Destructor.
 
void Activate ()
 Activate the input context (this just calls the base InputChannelEventListener::Connect)
 
void Deactivate ()
 Deactivate the input context (this just calls the base InputChannelEventListener::Disconnect)
 
bool AddInputMapping (AZStd::shared_ptr< InputMapping > inputMapping)
 
bool RemoveInputMapping (const InputChannelId &inputMappingId)
 
- Public Member Functions inherited from AzFramework::InputDevice
 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 InputDeviceGetInputDevice () const final
 AzFramework::InputDeviceRequests::GetInputDevice
 
const InputDeviceIdGetInputDeviceId () 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
 
- Public Member Functions inherited from AzFramework::InputChannelEventListener
 InputChannelEventListener ()
 Constructor.
 
 InputChannelEventListener (bool autoConnect)
 
 InputChannelEventListener (AZ::s32 priority)
 
 InputChannelEventListener (AZ::s32 priority, bool autoConnect)
 
 InputChannelEventListener (AZStd::shared_ptr< InputChannelEventFilter > filter)
 
 InputChannelEventListener (AZStd::shared_ptr< InputChannelEventFilter > filter, AZ::s32 priority)
 
 InputChannelEventListener (AZStd::shared_ptr< InputChannelEventFilter > filter, AZ::s32 priority, bool autoConnect)
 
 AZ_DEFAULT_COPY (InputChannelEventListener)
 
 ~InputChannelEventListener () override=default
 Default destructor.
 
AZ::s32 GetPriority () const override
 AzFramework::InputChannelNotifications::GetPriority
 
void SetFilter (AZStd::shared_ptr< InputChannelEventFilter > filter)
 
void Connect ()
 Connect to the input notification bus to start receiving input notifications.
 
void Disconnect ()
 Disconnect from the input notification bus to stop receiving input notifications.
 

Protected Member Functions

const InputChannelByIdMap & GetInputChannelsById () const override
 AzFramework::InputDevice::GetInputChannelsById
 
bool IsSupported () const override
 AzFramework::InputDevice::IsSupported
 
bool IsConnected () const override
 AzFramework::InputDevice::IsConnected
 
void TickInputDevice () override
 AzFramework::InputDeviceRequests::TickInputDevice
 
bool OnInputChannelEventFiltered (const InputChannel &inputChannel) override
 AzFramework::InputChannelEventListener::OnInputChannelEventFiltered
 
- Protected Member Functions inherited from AzFramework::InputDevice
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.
 
- Protected Member Functions inherited from AzFramework::InputChannelEventListener
void OnInputChannelEvent (const InputChannel &inputChannel, bool &o_hasBeenConsumed) final
 AzFramework::InputChannelNotifications::OnInputChannelEvent
 
virtual bool OnInputChannelEventFiltered (const InputChannel &inputChannel)=0
 

Additional Inherited Members

- Static Public Member Functions inherited from AzFramework::InputDevice
static void Reflect (AZ::ReflectContext *context)
 
- Static Public Member Functions inherited from AzFramework::InputChannelEventListener
static AZ::s32 GetPriorityFirst ()
 
static AZ::s32 GetPriorityDebug ()
 
static AZ::s32 GetPriorityDebugUI ()
 
static AZ::s32 GetPriorityUI ()
 
static AZ::s32 GetPriorityDefault ()
 
static AZ::s32 GetPriorityLast ()
 

Detailed Description

An InputContext is an InputEventListener that owns a collection of InputMapping objects and forwards input events to them. By inheriting from InputEventListener the InputContext gains access to the same priority and 'consumed' systems that all other input event listeners use, meaning they can be interleaved with any other engine / gameplay system that consumes input. InputContext also inherits from InputDevice, which while unintuitive is necessary for input mapping instances that need to be created by passing a reference to the parent input device.

Constructor & Destructor Documentation

◆ InputContext() [1/2]

AzFramework::InputContext::InputContext ( const char *  name)
explicit

Constructor

Parameters
[in]nameUnique, will be truncated if exceeds InputDeviceId::MAX_NAME_LENGTH = 64

◆ InputContext() [2/2]

AzFramework::InputContext::InputContext ( const char *  name,
const InitData initData 
)

Constructor

Parameters
[in]nameUnique, will be truncated if exceeds InputDeviceId::MAX_NAME_LENGTH = 64
[in]initDataCustom data struct used to initialize the input context

Member Function Documentation

◆ AddInputMapping()

bool AzFramework::InputContext::AddInputMapping ( AZStd::shared_ptr< InputMapping inputMapping)

Add an input mapping to this input context (the input context will share ownership of it)

Parameters
[in]inputMappingShared pointer to the input mapping to add to this input context
Returns
True if the input mapping was added to this input context, false otherwise

◆ GetInputChannelsById()

const InputChannelByIdMap & AzFramework::InputContext::GetInputChannelsById ( ) const
overrideprotectedvirtual

◆ IsConnected()

bool AzFramework::InputContext::IsConnected ( ) const
overrideprotectedvirtual

◆ IsSupported()

bool AzFramework::InputContext::IsSupported ( ) const
overrideprotectedvirtual

◆ OnInputChannelEventFiltered()

bool AzFramework::InputContext::OnInputChannelEventFiltered ( const InputChannel inputChannel)
overrideprotectedvirtual

◆ RemoveInputMapping()

bool AzFramework::InputContext::RemoveInputMapping ( const InputChannelId inputMappingId)

Remove an input mapping from this input context (the shared ownership will be released)

Parameters
[in]inputMappingIdThe id of the input mapping to remove from this input context
Returns
True if the input mapping was removed from this input context, false otherwise

The documentation for this class was generated from the following file: