q5play
    Preparing search index...

    Class Contro

    Hierarchy (View Summary)

    Index

    Constructors

    • Stores the input status of buttons, triggers, and sticks on game controllers. Used internally to create controller objects for the contros array (aka controllers).

      Can also be used to create a mock controller object.

      Parameters

      • gp: string | Gamepad

      Returns Contro

    Properties

    a: number
    axeMapping: any

    Sticks and triggers are mapped to gamepad.axes indices.

    b: number
    buttonMapping: any

    Button names are mapped to gamepad.buttons indices.

    connected: boolean
    down: number
    gamepad: Gamepad
    hasAnalogTriggers: boolean

    True if the controller has analog triggers. False if the controller has digital (button) triggers.

    holdThreshold: number

    The amount of frames an input must be pressed to be considered held.

    12
    
    id: any
    isMock: boolean

    If the controller is a mock controller.

    l: number

    Left shoulder button.

    left: number
    leftStick: any

    Has x and y properties with -1 to 1 values which represent the position of the left analog stick.

    {x: 0, y: 0} is the center position.

    leftTrigger: number

    Analog value 0-1 of the left trigger.

    0
    
    lsb: number

    Left stick button. Activated by pressing down on the left analog stick.

    lt: number

    Digital left trigger.

    r: number

    Right shoulder button.

    right: number
    rightStick: any

    Has x and y properties with -1 to 1 values which represent the position of the right analog stick.

    {x: 0, y: 0} is the center position.

    rightTrigger: number

    Analog value 0-1 of the right trigger.

    0
    
    rsb: number

    Right stick button. Activated by pressing down on the right analog stick.

    rt: number

    Digital right trigger.

    select: number
    start: number
    up: number
    x: number
    y: number

    Accessors

    • get l1(): number

      Alias for l (left shoulder button). l1 is what it's called on PlayStation controllers.

      Returns number

    • get l2(): number

      Alias for leftTrigger (analog left trigger). l2 is what it's called on PlayStation controllers.

      Returns number

    • get l3(): number

      Alias for lsb (left stick button). l3 is what it's called on PlayStation controllers.

      Returns number

    • get lb(): number

      Alias for l (left shoulder button). lb is what it's called on Xbox controllers.

      Returns number

    • get leftStickButton(): number

      Verbose alias for lsb.

      Returns number

    • get r1(): number

      Alias for r (right shoulder button). r1 is what it's called on PlayStation controllers.

      Returns number

    • get r2(): number

      Alias for rightTrigger (analog right trigger). r2 is what it's called on PlayStation controllers.

      Returns number

    • get r3(): number

      Alias for rsb (right stick button). r3 is what it's called on PlayStation controllers.

      Returns number

    • get rb(): number

      Alias for r (right shoulder button). rb is what it's called on Xbox controllers.

      Returns number

    • get rightStickButton(): number

      Verbose alias for rsb.

      Returns number

    • get zl(): number

      Alias for lt (digital left trigger). zl is what it's called on Nintendo controllers.

      Returns number

    • get zr(): number

      Alias for rt (digital right trigger). zr is what it's called on Nintendo controllers.

      Returns number

    Methods

    • Parameters

      • Optionalinp: string

      Returns boolean

      true on the first frame that the user released a held input

    • Parameters

      • Optionalinp: string

      Returns number

      the amount of frames the user has been holding the input

    • Parameters

      • Optionalinp: string

      Returns boolean

      true on the first frame that the user holds the input

    • Same as the released function, which is preferred.

      Parameters

      • Optionalinp: string

      Returns boolean

      true on the first frame that the user released the input

    • Parameters

      • Optionalinp: string

      Returns boolean

      true on the first frame that the user presses the input

    • Parameters

      • Optionalinp: string

      Returns number

      the amount of frames the user has been pressing the input

    • Parameters

      • Optionalinp: string

      Returns boolean

      true on the first frame that the user released the input