Changes

388 bytes added ,  17:09, 18 November 2022
→‎Gamepad: Formatting and performance hint
Line 412: Line 412:  
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 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.
    +
Both of the gamepad's arrays, which contain the states of various inputs, seem to be reconstructed each time they are accessed via their gamepad object. It is not known if the values within the arrays can update upon each access of the array, but the values <em>can</em> update frequently enough to obtain accurate readings of the system's controls.
 +
 +
===== Axes =====
 
The gamepad's <code>axes</code> array contains four floating-point numbers in the following order:
 
The gamepad's <code>axes</code> array contains four floating-point numbers in the following order:
   Line 428: Line 431:  
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.
 
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.
    +
===== Buttons =====
 
The gamepad's <code>buttons</code> array contains numbers for the following numbers:
 
The gamepad's <code>buttons</code> array contains numbers for the following numbers:
 
{|class="wikitable" width="20%"
 
{|class="wikitable" width="20%"
26

edits