GamepadChip

GamepadChip

The GamepadChip allows you to control your gadgets using your computer's real game controller.

Similar in functionality to the Keyboard chip.

Properties

GamepadIndex number

Setting this property allows you to select which one of the gamepads currently connected to your computer the chip will use.

IsActive boolean read only

Returns whether or not the selected gamepad is currently active (plugged in and available) on your computer.

Methods

GetButton( name InputName ) InputSource

Returns an InputSource for a given button.

GetAxis( name InputName ) InputSource

Returns an InputSource axis for a given axis.

GetButtonAxis( negativeName InputName, positiveName InputName ) InputSource

Returns an InputSource axis controlled by two given buttons, one for negative and one for positive values.

Events

GamepadChipIsActiveEvent : { IsActive boolean, Type string }

Triggered when a gamepad becomes active or inactive.
* IsActive returns whether or not the selected gamepad currently became active.
* Type is "GamepadChipIsActiveEvent".

GamepadChipButtonEvent : { ButtonDown boolean, ButtonUp boolean, IsAxis boolean, InputName InputName, Type string }

Triggered when a gamepad control is pressed or released.
* ButtonDown is true if a button or axis was pressed at this event.
* ButtonUp is true if a button or axis was released at this event.
* IsAxis is true if the input that triggered this event is an axis.
* InputName returns the input name of the key that triggered this event.
* Type is "GamepadChipButtonEvent".

Input names

The following inputs can be used as axis, that is, they return analog values ranging from -100 to 100.

  • GamepadChip.LeftStickX
  • GamepadChip.LeftStickY
  • GamepadChip.RightStickX
  • GamepadChip.RightStickY

The following inputs can be used as buttons, that is, they can be pressed or released.

  • GamepadChip.ActionBottomRow1
  • GamepadChip.ActionBottomRow2
  • GamepadChip.ActionBottomRow3
  • GamepadChip.ActionTopRow1
  • GamepadChip.ActionTopRow2
  • GamepadChip.ActionTopRow3
  • GamepadChip.LeftShoulder1
  • GamepadChip.LeftShoulder2
  • GamepadChip.RightShoulder1
  • GamepadChip.RightShoulder2
  • GamepadChip.Center1
  • GamepadChip.Center2
  • GamepadChip.Center3
  • GamepadChip.LeftStickButton
  • GamepadChip.RightStickButton
  • GamepadChip.DPadUp
  • GamepadChip.DPadRight
  • GamepadChip.DPadDown
  • GamepadChip.DPadLeft