Changes

1,430 bytes added ,  21:07, 15 November 2022
Gamepad
Line 408: Line 408:     
MJPEG + .avi is also supported.
 
MJPEG + .avi is also supported.
 +
 +
==== Gamepad ====
 +
The browser's now-outdated gamepad API provides information about the states of the circle pad, C-stick, and every button aside from the Home and Power buttons. The gamepad, which has an ID of <code>New Nintendo 3DS Controller</code>, is contained within the array returned by the <code>navigator.webkitGetGamepads</code> function.
 +
 +
The gamepad's <code>axes</code> array contains four floating-point numbers in the following order:
 +
 +
{|class="wikitable" width="20%"
 +
! Index !! Axis
 +
|-
 +
| 0 || Circle pad X
 +
|-
 +
| 1 || Circle pad Y
 +
|-
 +
| 2 || C-stick X
 +
|-
 +
| 3 || C-stick Y
 +
|}
 +
 +
Each coordinate ranges from -1.0 (left/up) to 1.0 (right/down). Neutral position is indicated by 0.0. Drift and/or inaccurate calibration may make these exact values unattainable.
 +
 +
The gamepad's <code>buttons</code> array contains numbers for the following numbers:
 +
{|class="wikitable" width="20%"
 +
! Index !! Button
 +
|-
 +
| 0 || B
 +
|-
 +
| 1 || A
 +
|-
 +
| 2 || Y
 +
|-
 +
| 3 || X
 +
|-
 +
| 4 || L
 +
|-
 +
| 5 || R
 +
|-
 +
| 6 || ZL
 +
|-
 +
| 7 || ZR
 +
|-
 +
| 8 || Select
 +
|-
 +
| 9 || Start
 +
|-
 +
| 10 || Unknown
 +
|-
 +
| 11 || Unknown
 +
|-
 +
| 12 || Up
 +
|-
 +
| 13 || Down
 +
|-
 +
| 14 || Left
 +
|-
 +
| 15 || Right
 +
|}
 +
 +
Each number is 0 while its associated button is not pressed, and 1 while the button is pressed.
 +
 +
The two unknown button numbers may have been intended for the Home and Power buttons, but they are always 0, even if the web browser is used while the Home and/or Power buttons are pressed.
    
==== Notes ====
 
==== Notes ====
26

edits