You.i Engine
CYIActionEvent Class Reference

Detailed Description

Stores data related to a user Action event.

Action events represent any type of mouse or touchscreen events issued by the user.

#include <event/YiActionEvent.h>

Inheritance diagram for CYIActionEvent:

Public Types

enum  ButtonType : uint8_t {
  ButtonType::None = 0x00,
  ButtonType::Left = 0x01,
  ButtonType::Right = 0x02,
  ButtonType::Middle = 0x04
}
 
- Public Types inherited from CYIEvent
enum  Type : uint8_t {
  Type::None = 0,
  Type::ActionMove,
  Type::ActionDown,
  Type::ActionDelayedDown,
  Type::ActionUp,
  Type::ActionWheel,
  Type::ActionWheelHorizontal,
  Type::ActionWheelVertical,
  Type::ActionClick,
  Type::ActionOut,
  Type::ActionIn,
  Type::ActionEnter,
  Type::ActionLeave,
  Type::ActionPick,
  Type::ActionLongPress,
  Type::ActionSuppressedMove,
  Type::KeyDown,
  Type::KeyUp,
  Type::KeyInput,
  Type::SignalEmit,
  Type::StateMachineWrapped,
  Type::StateMachineSignal,
  Type::GPUGenerateHandle,
  Type::GPULoadBuffer,
  Type::GPUUnloadBuffer,
  Type::GPUFreeHandle,
  Type::GPUInvalidateHandle,
  Type::FocusIn,
  Type::FocusOut,
  Type::TrackpadDown,
  Type::TrackpadMove,
  Type::TrackpadUp,
  Type::DeferredDeletion,
  Type::Task,
  Type::AccessibilityAnnounce,
  Type::AccessibilityFocusIn,
  Type::AccessibilityFocusOut,
  Type::AccessibilityFocusNext,
  Type::AccessibilityFocusPrevious,
  Type::TypesCount
}
 The event type of the CYIEvent class instance. More...
 
enum  Phase : uint8_t {
  Phase::None = 0,
  Phase::Capture,
  Phase::AtTarget,
  Phase::Bubble,
  Phase::Broadcast
}
 The current processing phase of the event. More...
 
enum  Priority {
  Priority::Highest = 2,
  Priority::High = 1,
  Priority::Normal = 0,
  Priority::Low = -1,
  Priority::Lowest = -2,
  Priority::Default = Normal
}
 Priority of the event in the event queue. More...
 

Public Member Functions

 CYIActionEvent (CYIEvent::Type eventType)
 
 CYIActionEvent (CYIEvent::Type eventType, int32_t x, int32_t y, uint8_t pointerID=0)
 
 CYIActionEvent (CYIEvent::Type eventType, int32_t x, int32_t y, ButtonType button, uint8_t pointerID=0, bool hover=false)
 
 CYIActionEvent (int32_t x, int32_t y, int32_t wheelDelta, CYIEvent::Type eventType=CYIEvent::Type::ActionWheel)
 
 CYIActionEvent (const CYIActionEvent &rOther)=default
 
virtual ~CYIActionEvent ()
 
- Public Member Functions inherited from CYIEvent
 CYIEvent (CYIEvent::Type eventType)
 
 CYIEvent (const CYIEvent &rOther)
 
virtual ~CYIEvent ()
 
CYIEventoperator= (const CYIEvent &rOther)
 
const CYIStringGetName () const
 
CYIEvent::Type GetType () const
 
void SetType (CYIEvent::Type eventType)
 
bool IsActionEvent () const
 
std::unique_ptr< CYIActionEventCloneAsActionEvent () const
 
bool IsKeyEvent () const
 
std::unique_ptr< CYIKeyEventCloneAsKeyEvent () const
 
bool IsFocusEvent () const
 
std::unique_ptr< CYIFocusEventCloneAsFocusEvent () const
 
bool IsTrackpadEvent () const
 
std::unique_ptr< CYITrackpadEventCloneAsTrackpadEvent () const
 
bool IsAccessibilityEvent () const
 
std::unique_ptr< CYIAccessibilityEventCloneAsAccessibilityEvent () const
 
void SetTarget (CYIEventTarget *pTarget)
 
CYIEventTargetGetTarget () const
 
const std::shared_ptr< CYIEventTargetProxy > & GetTargetProxy () const
 
void SetCurrentTarget (CYIEventTarget *pTarget)
 
const CYIEventTargetGetCurrentTarget () const
 
CYIEventTargetGetCurrentTarget ()
 
const std::shared_ptr< CYIEventTargetProxy > & GetCurrentTargetProxy () const
 

Public Attributes

int32_t m_x
 
int32_t m_y
 
int32_t m_wheelDelta
 
ButtonType m_button
 
bool m_isHoverType
 
uint8_t m_pointerID
 
CYIRay m_Ray
 
glm::vec3 m_localSpaceLocation
 
- Public Attributes inherited from CYIEvent
uint64_t m_eventTimeMs
 
Phase m_phase
 
bool m_canCancel
 
bool m_canBubble
 
bool m_canCapture
 
bool m_stopPropagation
 
bool m_handled
 

Member Enumeration Documentation

◆ ButtonType

enum CYIActionEvent::ButtonType : uint8_t
strong
Enumerator
None 
Left 
Right 
Middle 

Constructor & Destructor Documentation

◆ CYIActionEvent() [1/5]

CYIActionEvent::CYIActionEvent ( CYIEvent::Type  eventType)

Constructs an action event from the given event type. Will assert if the type is not an action event. All necessary parametes are expected to be populated by the user.

◆ CYIActionEvent() [2/5]

CYIActionEvent::CYIActionEvent ( CYIEvent::Type  eventType,
int32_t  x,
int32_t  y,
uint8_t  pointerID = 0 
)

Constructs an action event from the given event type, at a known coordinate. Will assert if the type is not an action event.

◆ CYIActionEvent() [3/5]

CYIActionEvent::CYIActionEvent ( CYIEvent::Type  eventType,
int32_t  x,
int32_t  y,
ButtonType  button,
uint8_t  pointerID = 0,
bool  hover = false 
)

Constructs an action event from the given event type. Will assert if the type is not an action event.

◆ CYIActionEvent() [4/5]

CYIActionEvent::CYIActionEvent ( int32_t  x,
int32_t  y,
int32_t  wheelDelta,
CYIEvent::Type  eventType = CYIEvent::Type::ActionWheel 
)

Constructs an action event from the given event mouse wheel type, at a known coordinate. Will assert if the type is not an action event.

◆ CYIActionEvent() [5/5]

CYIActionEvent::CYIActionEvent ( const CYIActionEvent rOther)
default

◆ ~CYIActionEvent()

virtual CYIActionEvent::~CYIActionEvent ( )
virtual

Member Data Documentation

◆ m_button

ButtonType CYIActionEvent::m_button

The CYIActionEvent::ButtonType that was used. If multiple buttons are associated with the event, this value will be the combined bitmask of all associated button types.

◆ m_isHoverType

bool CYIActionEvent::m_isHoverType

True if the action event is a hover event. An example would be a mouse over event.

◆ m_localSpaceLocation

glm::vec3 CYIActionEvent::m_localSpaceLocation

Location of the event in local coordinates. This is determined by intersecting CYIActionEvent::m_Ray with the current target node's mesh, and is updated as the scene tree is traversed. This is 0 if the current target node has no mesh.

◆ m_pointerID

uint8_t CYIActionEvent::m_pointerID

The pointer ID literally refers to a finger on a multi-touch device. Currently this is only supported by Android. For example: if two fingers are down on the tablet, the indexes 0 and 1 are assigned respectively. Then when the user lifts the first finger placed on the tablet the index for the remaining finger would be 1.

◆ m_Ray

CYIRay CYIActionEvent::m_Ray

The ray is used for picking. The ray is created from the screen coordinates of the event, but as the scene tree is traversed, the ray is tranformed into each node's local space.

◆ m_wheelDelta

int32_t CYIActionEvent::m_wheelDelta

If the action is CYIEvent::Type::ActionWheel then this is the distance the wheel has rotated since the last CYIEvent::Type::ActionWheel event. A positive value indicates that the wheel was rotated forward. This is typically 0 for all other event types.

◆ m_x

int32_t CYIActionEvent::m_x

The x location of the event in screen coordinates.

◆ m_y

int32_t CYIActionEvent::m_y

The y location of the event in screen coordinates.


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