Axmol 3.0.0-89d6d9a
Loading...
Searching...
No Matches
KeyboardEvent Class Reference

Keyboard event. More...

#include <KeyboardEvent.h>

Inherits Event.

Public Types

enum class  KeyCode
 KeyCode The key (code).
Public Types inherited from Event
enum class  Type
 Type Event type.

Public Member Functions

 KeyboardEvent (KeyCode keyCode, InputPhase phase)
 Constructor.
 KeyboardEvent (KeyCode keyCode, InputPhase phase, uint32_t modifiers)
 Constructor.
KeyCode getKeyCode () const
 Get the key code.
InputPhase getPhase () const
 Retrieve the phase of this keyboard event.
uint32_t getModifiers () const
 Retrieve the modifiers of this keyboard event.
Public Member Functions inherited from Event
 Event (Type type)
 Constructor.
virtual ~Event ()
 Destructor.
Type getType () const
 Gets the event type.
void stopPropagation ()
 Stops propagation for current event.
bool isStopped () const
 Checks whether the event has been stopped.
Node * getCurrentTarget ()
 Gets current target of the event.
Public Member Functions inherited from Object
void retain ()
 Retains the ownership.
void release ()
 Releases the ownership immediately.
Object * autorelease ()
 Releases the ownership sometime soon automatically.
unsigned int getReferenceCount () const
 Returns the Object's current reference count.
uint64_t getObjectID () const noexcept
 Returns the process-local diagnostic identifier assigned at construction.
virtual ~Object ()
 Destructor.

Detailed Description

Keyboard event.

Constructor & Destructor Documentation

◆ KeyboardEvent() [1/2]

KeyboardEvent ( KeyCode keyCode,
InputPhase phase )

Constructor.

Parameters
keyCodeA given keycode.
phaseInput phase

◆ KeyboardEvent() [2/2]

KeyboardEvent ( KeyCode keyCode,
InputPhase phase,
uint32_t modifiers )

Constructor.

Parameters
keyCodeA given keycode.
phaseInput phase
modifiersidentifies any modifier keys that are active

Member Function Documentation

◆ getKeyCode()

KeyCode getKeyCode ( ) const
inline

Get the key code.

Returns
The key code associated with this event.

◆ getPhase()

InputPhase getPhase ( ) const
inline

Retrieve the phase of this keyboard event.

Returns the input phase that describes the current state of the keyboard interaction, such as when a key is pressed, released, or held in repeat mode.

Returns
InputPhase enumeration value indicating the event phase:
  • InputPhase::KeyDown when the key is pressed
  • InputPhase::KeyUp when the key is released
  • InputPhase::KeyRepeat when the key is repeating
Note
This reflects only the state of this KeyboardEvent instance and does not query the global keyboard state.

◆ getModifiers()

uint32_t getModifiers ( ) const
inline

Retrieve the modifiers of this keyboard event.

Returns the modifier keys

Returns
uint32_t bitmasked value of modifier keys as declared in KeyModifier

The documentation for this class was generated from the following file:
  • KeyboardEvent.h