Open 3D Engine Gestures Gem 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.
Gestures::IRecognizer Class Referenceabstract

Base class for all gesture recognizers. More...

#include <IGestureRecognizer.h>

Inherits AzFramework::InputChannelNotificationBus::Handler, and AzFramework::InputChannel::PositionData2D.

Inherited by Gestures::RecognizerContinuous, and Gestures::RecognizerDiscrete.

Classes

struct  ScreenPosition
 

Public Member Functions

 AZ_CLASS_ALLOCATOR (IRecognizer, AZ::SystemAllocator)
 
 AZ_RTTI (IRecognizer, "{C3E00298-1953-465F-A360-EBC10B62BFE8}", CustomData)
 
void Enable ()
 Enable this gesture recognizer.
 
void Disable ()
 Disable this gesture recognizer.
 
AZ::s32 GetPriority () const override
 AzFramework::InputChannelNotifications::GetPriority
 
void OnInputChannelEvent (const AzFramework::InputChannel &inputChannel, bool &o_hasBeenConsumed) override
 AzFramework::InputChannelNotifications::OnInputChannelEvent
 
virtual bool OnPressedEvent (const AZ::Vector2 &screenPositionPixels, uint32_t pointerIndex)=0
 
virtual bool OnDownEvent (const AZ::Vector2 &screenPositionPixels, uint32_t pointerIndex)=0
 
virtual bool OnReleasedEvent (const AZ::Vector2 &screenPositionPixels, uint32_t pointerIndex)=0
 

Protected Member Functions

uint32_t GetGesturePointerIndex (const AzFramework::InputChannel &inputChannel)
 
void UpdateNormalizedPositionAndDeltaFromScreenPosition (const AZ::Vector2 &screenPositionPixels)
 

Protected Attributes

const uint32_t INVALID_GESTURE_POINTER_INDEX = static_cast<uint32_t>(-1)
 

Detailed Description

Base class for all gesture recognizers.

Member Function Documentation

◆ GetGesturePointerIndex()

uint32_t Gestures::IRecognizer::GetGesturePointerIndex ( const AzFramework::InputChannel &  inputChannel)
inlineprotected

Get the gesture pointer index associated with an input channel.

Parameters
[in]inputChannelThe input channel to find the pointer index for.
Returns
The gesture pointer index of the input channel, or INVALID_GESTURE_POINTER_INDEX.

◆ OnDownEvent()

virtual bool Gestures::IRecognizer::OnDownEvent ( const AZ::Vector2 &  screenPositionPixels,
uint32_t  pointerIndex 
)
pure virtual

Override to be notified each frame a mouse button or finger on a touch screen remains pressed, unless the input event was consumed by a higher priority gesture recognizer.

Parameters
[in]screenPositionPixelsThe screen position (in pixels) of the input event.
[in]pointerIndexThe pointer index of the input event.
Returns
True to consume the underlying input event (preventing it from being sent on to other lower-priority gesture recognizers or input listeners), or false otherwise.

Implemented in Gestures::RecognizerClickOrTap, Gestures::RecognizerDrag, Gestures::RecognizerHold, Gestures::RecognizerPinch, Gestures::RecognizerRotate, and Gestures::RecognizerSwipe.

◆ OnPressedEvent()

virtual bool Gestures::IRecognizer::OnPressedEvent ( const AZ::Vector2 &  screenPositionPixels,
uint32_t  pointerIndex 
)
pure virtual

Override to be notified when a mouse button or finger on a touch screen is initially pressed, unless the input event was consumed by a higher priority gesture recognizer.

Parameters
[in]screenPositionPixelsThe screen position (in pixels) of the input event.
[in]pointerIndexThe pointer index of the input event.
Returns
True to consume the underlying input event (preventing it from being sent on to other lower-priority gesture recognizers or input listeners), or false otherwise.

Implemented in Gestures::RecognizerClickOrTap, Gestures::RecognizerDrag, Gestures::RecognizerHold, Gestures::RecognizerPinch, Gestures::RecognizerRotate, and Gestures::RecognizerSwipe.

◆ OnReleasedEvent()

virtual bool Gestures::IRecognizer::OnReleasedEvent ( const AZ::Vector2 &  screenPositionPixels,
uint32_t  pointerIndex 
)
pure virtual

Override to be notified when a pressed mouse button or finger on a touch screen becomes released, unless the input event was consumed by a higher priority gesture recognizer.

Parameters
[in]screenPositionPixelsThe screen position (in pixels) of the input event.
[in]pointerIndexThe pointer index of the input event.
Returns
True to consume the underlying input event (preventing it from being sent on to other lower-priority gesture recognizers or input listeners), or false otherwise.

Implemented in Gestures::RecognizerClickOrTap, Gestures::RecognizerDrag, Gestures::RecognizerHold, Gestures::RecognizerPinch, Gestures::RecognizerRotate, and Gestures::RecognizerSwipe.

◆ UpdateNormalizedPositionAndDeltaFromScreenPosition()

void Gestures::IRecognizer::UpdateNormalizedPositionAndDeltaFromScreenPosition ( const AZ::Vector2 &  screenPositionPixels)
inlineprotected

Convenience function that converts back to a normalized position before calling through to the base AzFramework::InputChannel::PositionData2D::UpdateNormalizedPositionAndDelta

Parameters
[in]screenPositionPixelsThe screen position (in pixels) of the input event.

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