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

#include <InputDeviceGamepad.h>

Inherits AzFramework::InputDevice, InputHapticFeedbackRequestBus::Handler, and InputLightBarRequestBus::Handler.

Classes

struct  Button
 All the input channel ids that identify game-pad digital button input. More...
 
class  Implementation
 Base class for platform specific implementations of game-pad input devices. More...
 
struct  ThumbStickAxis1D
 All the input channel ids that identify game-pad thumb-stick 1D axis input. More...
 
struct  ThumbStickAxis2D
 All the input channel ids that identify game-pad thumb-stick 2D axis input. More...
 
struct  ThumbStickDirection
 All the input channel ids that identify game-pad thumb-stick directional input. More...
 
struct  Trigger
 All the input channel ids that identify game-pad analog trigger input. More...
 

Public Types

using ImplementationFactory = Implementation *(InputDeviceGamepad &)
 Alias for the function type used to create a custom implementation for this input device.
 

Public Member Functions

 AZ_CLASS_ALLOCATOR (InputDeviceGamepad, AZ::SystemAllocator)
 
 AZ_RTTI (InputDeviceGamepad, "{16652E28-4B60-4852-BBD0-CB6A2D1B7377}", InputDevice)
 
 InputDeviceGamepad ()
 Constructor.
 
 InputDeviceGamepad (AZ::u32 index)
 
 InputDeviceGamepad (const InputDeviceId &inputDeviceId, ImplementationFactory implementationFactory=&Implementation::Create)
 
 AZ_DISABLE_COPY_MOVE (InputDeviceGamepad)
 
 ~InputDeviceGamepad () override
 Destructor.
 
LocalUserId GetAssignedLocalUserId () const override
 AzFramework::InputDevice::GetAssignedLocalUserId
 
void PromptLocalUserSignIn () const override
 AzFramework::InputDevice::PromptLocalUserSignIn
 
const InputChannelByIdMap & GetInputChannelsById () const override
 AzFramework::InputDevice::GetInputChannelsById
 
bool IsSupported () const override
 AzFramework::InputDevice::IsSupported
 
bool IsConnected () const override
 AzFramework::InputDevice::IsConnected
 
void GetPhysicalKeyOrButtonText (const InputChannelId &inputChannelId, AZStd::string &o_keyOrButtonText) const override
 AzFramework::InputDeviceRequests::GetPhysicalKeyOrButtonText
 
void TickInputDevice () override
 AzFramework::InputDeviceRequests::TickInputDevice
 
void SetVibration (float leftMotorSpeedNormalized, float rightMotorSpeedNormalized) override
 AzFramework::InputHapticFeedbackRequests::SetVibration
 
void SetLightBarColor (const AZ::Color &color) override
 AzFramework::InputLightBarRequests::SetLightBarColor
 
void ResetLightBarColor () override
 AzFramework::InputLightBarRequests::ResetLightBarColor
 
void SetImplementation (AZStd::unique_ptr< Implementation > impl)
 
- 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
 

Static Public Member Functions

static bool IsGamepadDevice (const InputDeviceId &inputDeviceId)
 
static AZ::u32 GetMaxSupportedGamepads ()
 
static void Reflect (AZ::ReflectContext *context)
 
- Static Public Member Functions inherited from AzFramework::InputDevice
static void Reflect (AZ::ReflectContext *context)
 

Static Public Attributes

static constexpr const char * Name {"gamepad"}
 The name used to identify any game-pad input device.
 

Protected Types

using ButtonChannelByIdMap = AZStd::unordered_map< InputChannelId, InputChannelDigital * >
 
using TriggerChannelByIdMap = AZStd::unordered_map< InputChannelId, InputChannelAnalog * >
 
using ThumbStickAxis1DChannelByIdMap = AZStd::unordered_map< InputChannelId, InputChannelAxis1D * >
 
using ThumbStickAxis2DChannelByIdMap = AZStd::unordered_map< InputChannelId, InputChannelAxis2D * >
 
using ThumbStickDirectionChannelByIdMap = AZStd::unordered_map< InputChannelId, InputChannelAnalog * >
 

Protected Attributes

InputChannelByIdMap m_allChannelsById
 All game-pad input channels by id.
 
ButtonChannelByIdMap m_buttonChannelsById
 All digital button channels by id.
 
TriggerChannelByIdMap m_triggerChannelsById
 All analog trigger channels by id.
 
ThumbStickAxis1DChannelByIdMap m_thumbStickAxis1DChannelsById
 All thumb-stick axis 1D channels by id.
 
ThumbStickAxis2DChannelByIdMap m_thumbStickAxis2DChannelsById
 All thumb-stick axis 2D channels by id.
 
ThumbStickDirectionChannelByIdMap m_thumbStickDirectionChannelsById
 All thumb-stick direction channels by id.
 
static constexpr InputDeviceId IdForIndex0 {Name, 0}
 
static constexpr InputDeviceId IdForIndex1 {Name, 1}
 
static constexpr InputDeviceId IdForIndex2 {Name, 2}
 
static constexpr InputDeviceId IdForIndex3 {Name, 3}
 
static constexpr InputDeviceId IdForIndexN (AZ::u32 n)
 

Additional Inherited Members

- 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.
 

Detailed Description

Defines a generic game-pad input device, including the ids of all associated input channels. Platform specific implementations are defined as private implementations so that creating an instance of this generic class will work correctly on any platform supporting game-pad input, while providing access to the device name and associated channel ids on any platform through the 'null' implementation (primarily so that the editor can use them to setup input mappings).

Member Typedef Documentation

◆ ButtonChannelByIdMap

Alias for verbose container class

Constructor & Destructor Documentation

◆ InputDeviceGamepad() [1/2]

AzFramework::InputDeviceGamepad::InputDeviceGamepad ( AZ::u32  index)
explicit

Constructor

Parameters
[in]indexIndex of the game-pad device

◆ InputDeviceGamepad() [2/2]

AzFramework::InputDeviceGamepad::InputDeviceGamepad ( const InputDeviceId inputDeviceId,
ImplementationFactory  implementationFactory = &Implementation::Create 
)
explicit

Constructor

Parameters
[in]inputDeviceIdId of the input device
[in]implementationFactoryOptional override of the default Implementation::Create

Member Function Documentation

◆ GetAssignedLocalUserId()

LocalUserId AzFramework::InputDeviceGamepad::GetAssignedLocalUserId ( ) const
overridevirtual

◆ GetInputChannelsById()

const InputChannelByIdMap & AzFramework::InputDeviceGamepad::GetInputChannelsById ( ) const
overridevirtual

◆ GetMaxSupportedGamepads()

static AZ::u32 AzFramework::InputDeviceGamepad::GetMaxSupportedGamepads ( )
static

Get the maximum number of gamepads that are supported on the current platform

Returns
The maximum number of gamepads that are supported on the current platform

◆ IsConnected()

bool AzFramework::InputDeviceGamepad::IsConnected ( ) const
overridevirtual

◆ IsGamepadDevice()

static bool AzFramework::InputDeviceGamepad::IsGamepadDevice ( const InputDeviceId inputDeviceId)
static

Check whether an input device id identifies a gamepad (regardless of index)

Parameters
[in]inputDeviceIdThe input device id to check
Returns
True if the input device id identifies a gamepad, false otherwise

◆ IsSupported()

bool AzFramework::InputDeviceGamepad::IsSupported ( ) const
overridevirtual

◆ PromptLocalUserSignIn()

void AzFramework::InputDeviceGamepad::PromptLocalUserSignIn ( ) const
overridevirtual

◆ SetImplementation()

void AzFramework::InputDeviceGamepad::SetImplementation ( AZStd::unique_ptr< Implementation impl)
inline

Set the implementation of this input device

Parameters
[in]implementationThe new implementation

Member Data Documentation

◆ IdForIndex0

constexpr InputDeviceId AzFramework::InputDeviceGamepad::IdForIndex0 {Name, 0}
inlinestaticconstexpr

The id used to identify a game-pad input device with a specific index


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