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::InputChannelRequests Class Referenceabstract

EBus interface used to query for available input channels. More...

#include <InputChannelRequestBus.h>

Inherits AZ::EBusTraits.

Classes

class  BusIdType
 

Public Member Functions

virtual const InputChannelGetInputChannel () const =0
 
virtual void ResetState ()=0
 
virtual void SimulateRawInput (float)
 
virtual void SimulateRawInput2D (float, float)
 
virtual void SimulateRawInput3D (float, float, float)
 
virtual void SimulateRawInputWithPosition2D (float, float, float)
 
virtual ~InputChannelRequests ()=default
 Default destructor.
 

Static Public Member Functions

static const InputChannelFindInputChannel (const InputChannelId &channelId, AZ::u32 deviceIndex=0)
 

Static Public Attributes

static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById
 
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single
 EBus Trait: requests should be handled by only one input channel connected to each id.
 

Detailed Description

EBus interface used to query for available input channels.

Member Function Documentation

◆ FindInputChannel()

static const InputChannel * AzFramework::InputChannelRequests::FindInputChannel ( const InputChannelId channelId,
AZ::u32  deviceIndex = 0 
)
static

Finds a specific input channel given its id and the index of the device that owns it. This convenience function wraps an EBus call to InputChannelRequests::GetInputChannel.

Parameters
[in]channelIdId of the input channel to find
[in]deviceIndexIndex of the device that owns the input channel
Returns
Pointer to the input channel if it was found, nullptr if it was not

◆ GetInputChannel()

virtual const InputChannel * AzFramework::InputChannelRequests::GetInputChannel ( ) const
pure virtual

Returns the input channel uniquely identified by the id/index pair used to address calls. This should never be broadcast otherwise the channel returned will effectively be random.

Examples:

// Get the left mouse button input channel
const InputChannelRequests::BusIdType requestId(InputDeviceMouse::Button::Left);
const InputChannel* inputChannel = nullptr;
InputChannelRequestBus::EventResult(inputChannel,
                                    requestId,
                                    &InputChannelRequests::GetInputChannel);

// Get the A button input channel for the gamepad device at index 2
const InputChannelRequests::BusIdType requestId(InputDeviceGamepad::Button::A, 2);
const InputChannel* inputChannel = nullptr;
InputChannelRequestBus::EventResult(inputChannel,
                                    requestId,
                                    &InputChannelRequests::GetInputChannel);
Returns
Pointer to the input channel if it exists, nullptr otherwise

◆ ResetState()

virtual void AzFramework::InputChannelRequests::ResetState ( )
pure virtual

Reset the channel's state, which should broadcast an 'Ended' input notification event (if the channel is currently active) before returning the channel to the idle state.

◆ SimulateRawInput()

virtual void AzFramework::InputChannelRequests::SimulateRawInput ( float  )
inlinevirtual

Simulate a raw input event. Please use with caution; it's designed primarily for testing purposes, and could result in strange behaviour if called while the user is interacting physically with any input device that happens to be updating the same input channel(s), or if used to simulate input of an input channel whose value is derived from the value of a different input channel (eg. the InputDeviceGamepad::ThumbStickDirection::* input channel values are derived from their respective InputDeviceGamepad::ThumbStickAxis2D).

If used, it is the responsibility of the caller to reset the input channel back to it's original idle state, otherwise it may be left in a state of being permanently 'active'.

Parameters
[in]rawValueThe raw input value to simulate. Analog input channels will use the value directly, digital input channels treat 0.0f as 'off' and all other values as 'on'.

◆ SimulateRawInput2D()

virtual void AzFramework::InputChannelRequests::SimulateRawInput2D ( float  ,
float   
)
inlinevirtual

Simulate a raw input event. Please use with caution; it's designed primarily for testing purposes, and could result in strange behaviour if called while the user is interacting physically with any input device that happens to be updating the same input channel(s), or if used to simulate input of an input channel whose value is derived from the value of a different input channel (eg. the InputDeviceGamepad::ThumbStickDirection::* input channel values are derived from their respective InputDeviceGamepad::ThumbStickAxis2D).

If used, it is the responsibility of the caller to reset the input channel back to it's original idle state, otherwise it may be left in a state of being permanently 'active'.

Parameters
[in]rawValueXThe raw x-axis input value to simulate.
[in]rawValueYThe raw y-axis input value to simulate.

◆ SimulateRawInput3D()

virtual void AzFramework::InputChannelRequests::SimulateRawInput3D ( float  ,
float  ,
float   
)
inlinevirtual

Simulate a raw input event. Please use with caution; it's designed primarily for testing purposes, and could result in strange behaviour if called while the user is interacting physically with any input device that happens to be updating the same input channel(s), or if used to simulate input of an input channel whose value is derived from the value of a different input channel (eg. the InputDeviceGamepad::ThumbStickDirection::* input channel values are derived from their respective InputDeviceGamepad::ThumbStickAxis2D).

If used, it is the responsibility of the caller to reset the input channel back to it's original idle state, otherwise it may be left in a state of being permanently 'active'.

Parameters
[in]rawValueXThe raw x-axis input value to simulate.
[in]rawValueYThe raw y-axis input value to simulate.
[in]rawValueZThe raw z-axis input value to simulate.

◆ SimulateRawInputWithPosition2D()

virtual void AzFramework::InputChannelRequests::SimulateRawInputWithPosition2D ( float  ,
float  ,
float   
)
inlinevirtual

Simulate a raw input event. Please use with caution; it's designed primarily for testing purposes, and could result in strange behaviour if called while the user is interacting physically with any input device that happens to be updating the same input channel(s), or if used to simulate input of an input channel whose value is derived from the value of a different input channel (eg. the InputDeviceGamepad::ThumbStickDirection::* input channel values are derived from their respective InputDeviceGamepad::ThumbStickAxis2D).

If used, it is the responsibility of the caller to reset the input channel back to it's original idle state, otherwise it may be left in a state of being permanently 'active'.

Parameters
[in]rawValueThe raw input value to simulate. Analog input channels will use the value directly, digital input channels treat 0.0f as 'off' and all other values as 'on'.
[in]normalizedXThe normalized x position of the simulated raw input event.
[in]normalizedYThe normalized y position of the simulated raw input event.

Member Data Documentation

◆ AddressPolicy

const AZ::EBusAddressPolicy AzFramework::InputChannelRequests::AddressPolicy = AZ::EBusAddressPolicy::ById
static

EBus Trait: requests can be addressed to a specific InputChannelId so that they are only handled by one input channel that has connected to the bus using that unique id, or they can be broadcast to all input channels that have connected to the bus, regardless of id.


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