src/nodejs/jsgamepad

    Dark Mode
Search:
Group by:

Types

Gamepad = ref object of JsRoot
  axis*: seq[float]          ## https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/axes
  connected*: bool           ## https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/connected
  displayId*: SomeNumber     ## https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/displayId
  hand*: cstring             ## https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/hand
  id*: cstring               ## https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/id
  index*: SomeNumber         ## https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/index
  mapping*: cstring          ## https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/mapping
  buttons*: seq[GamepadButton] ## https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/buttons
  
https://developer.mozilla.org/en-US/docs/Web/API/Gamepad
GamepadButton = ref object of JsRoot
  pressed*: bool             ## https://developer.mozilla.org/en-US/docs/Web/API/GamepadButton/pressed
  touched*: bool             ## https://developer.mozilla.org/en-US/docs/Web/API/GamepadButton/touched
  value*: float              ## https://developer.mozilla.org/en-US/docs/Web/API/GamepadButton/value
  
https://developer.mozilla.org/en-US/docs/Web/API/GamepadButton

Procs

func getGamepads(): seq[Gamepad] {.importjs: "(navigator.$1(@) || [])",
                                   ...raises: [], tags: [].}
func getGamepads(index: Natural): Gamepad {.importjs: "(navigator.$1()[#])",
    ...raises: [], tags: [].}