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::InputChannelAxis2D Class Reference

#include <InputChannelAxis2D.h>

Inherits AzFramework::InputChannel.

Classes

struct  AxisData2D
 Custom data struct for two dimensional axis data. More...
 

Public Member Functions

 AZ_CLASS_ALLOCATOR (InputChannelAxis2D, AZ::SystemAllocator)
 
 AZ_RTTI (InputChannelAxis2D, "{03432ABA-C019-401A-B652-C56272FA4667}", InputChannel)
 
 InputChannelAxis2D (const InputChannelId &inputChannelId, const InputDevice &inputDevice)
 
 AZ_DISABLE_COPY_MOVE (InputChannelAxis2D)
 
 ~InputChannelAxis2D () override=default
 Default destructor.
 
float GetValue () const override
 
float GetDelta () const override
 
const InputChannel::CustomDataGetCustomData () const override
 
void ResetState () override
 AzFramework::InputChannelRequests::ResetState
 
void SimulateRawInput2D (float rawValueX, float rawValueY) override
 AzFramework::InputChannelRequests::SimulateRawInput2D
 
void ProcessRawInputEvent (const AZ::Vector2 &rawValuesPostDeadZone, const AZ::Vector2 *rawValuesPreDeadZone=nullptr)
 
- Public Member Functions inherited from AzFramework::InputChannel
 AZ_CLASS_ALLOCATOR (InputChannel, AZ::SystemAllocator)
 
 AZ_RTTI (InputChannel, "{1C88625D-D297-4A1C-AE07-E17F88D138F3}")
 
 InputChannel (const InputChannelId &inputChannelId, const InputDevice &inputDevice)
 
 AZ_DISABLE_COPY_MOVE (InputChannel)
 
 ~InputChannel () override
 Destructor.
 
const InputChannelGetInputChannel () const final
 AzFramework::InputChannelRequests::GetInputChannel
 
const InputChannelIdGetInputChannelId () const
 
const InputDeviceGetInputDevice () const
 
State GetState () const
 
bool IsActive () const
 
virtual float GetValue () const
 
virtual float GetDelta () const
 
virtual const CustomDataGetCustomData () const
 
template<class CustomDataType >
const CustomDataType * GetCustomData () const
 
bool UpdateState (bool isChannelActive)
 
void ResetState () override
 AzFramework::InputChannelRequests::ResetState
 
bool IsStateIdle () const
 
bool IsStateBegan () const
 
bool IsStateUpdated () const
 
bool IsStateEnded () const
 

Additional Inherited Members

- Public Types inherited from AzFramework::InputChannel
enum class  State { Idle , Began , Updated , Ended }
 State of the input channel (not all channels will go through all states) More...
 
using SharedPositionData2D = AZStd::shared_ptr< InputChannel::PositionData2D >
 Alias for verbose shared_ptr class.
 
- Static Public Member Functions inherited from AzFramework::InputChannel
static void Reflect (AZ::ReflectContext *context)
 

Detailed Description

Class for input channels that emit two dimensional axis input values. Example: game-pad thumb-stick x and y

Constructor & Destructor Documentation

◆ InputChannelAxis2D()

AzFramework::InputChannelAxis2D::InputChannelAxis2D ( const InputChannelId inputChannelId,
const InputDevice inputDevice 
)
explicit

Constructor

Parameters
[in]inputChannelIdId of the input channel being constructed
[in]inputDeviceInput device that owns the input channel

Member Function Documentation

◆ GetCustomData()

const InputChannel::CustomData * AzFramework::InputChannelAxis2D::GetCustomData ( ) const
overridevirtual

Access to the two dimensional axis data associated with the input channel

Returns
Pointer to the two dimensional axis data

Reimplemented from AzFramework::InputChannel.

◆ GetDelta()

float AzFramework::InputChannelAxis2D::GetDelta ( ) const
overridevirtual

Access to the total distance moved since last frame

Returns
The total distance moved since last frame

Reimplemented from AzFramework::InputChannel.

◆ GetValue()

float AzFramework::InputChannelAxis2D::GetValue ( ) const
overridevirtual

Access to the distance from the origin (length of the vector formed by the axis values)

Returns
The distance from the origin (length of the vector formed by the axis values)

Reimplemented from AzFramework::InputChannel.

◆ ProcessRawInputEvent()

void AzFramework::InputChannelAxis2D::ProcessRawInputEvent ( const AZ::Vector2 &  rawValuesPostDeadZone,
const AZ::Vector2 *  rawValuesPreDeadZone = nullptr 
)

Process a raw input event, that will in turn update the channel's state based on whether it's active/engaged or inactive/idle, broadcasting an input event if the channel is left in a non-idle state. This function (or InputChannel::UpdateState) should only be called a max of once per channel per frame from InputDeviceRequests::TickInputDevice to ensure that input channels broadcast no more than one event each frame (and at the same time). If rawValuesPreDeadZone is null, we'll assume it is the same as rawValuesPostDeadZone.

Parameters
[in]rawValuesPostDeadZoneRaw values after applying a platform-specific deadzone
[in]rawValuesPreDeadZoneRaw values before applying a platform-specific deadzone

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