Class CCEvent

A CCEvent holds information about a single event that was triggered by the system, application, or window manager.

Constructors

Properties

buttonNumber?: number

For mouse events, the mouse button pressed.

ccEvent?: any[]

If the event is from CraftOS, the raw event data.

characters?: string

For character input events, the characters pressed.

clickCount?: number

For mouse down events, the number of times the button was pressed.

extraParams?: object

For application-defined events, any extra parameters to pass.

isRepeat?: boolean

For key down events, whether the key was repeated.

keyCode?: CCKey

For key events, the key code pressed.

locationInWindow?: CCPoint

The location of the event relative to a window.

menuItemKey?: string

For menu item events, the key of the menu item triggered.

modifierFlags?: number

The modifier keys pressed with the event.

phoenixEvent?: { name: string; params: object }

If the event is from Phoenix, the raw event data.

scrollDirection?: number

For mouse scroll events, the direction of the scroll (1 or -1).

subtype: SubType = CCEvent.SubType.ApplicationActivated

The subtype of the event, if relevant.

timestamp: number = 0

The timestamp that the event occurred at.

type: Type = CCEvent.Type.ApplicationDefined

The type of the event.

window?: CCWindow

The window the event is intended for.

Accessors

  • get charactersIgnoringModifiers(): undefined | string
  • For character input events, the characters pressed, without modifier keys.

    Returns undefined | string

Methods

  • Starts sending periodic events to the application.

    Parameters

    • delay: number

      The number of seconds to wait until sending events

    • period: number

      The amount of time to wait between events

    Returns void

  • Stops sending periodic events if enabled.

    Returns void