Re: [w3c/gamepad] Add algorithms for getGamepads and events (#151)

@nondebug commented on this pull request.



> +      <ol>
+        <li>Let |gamepad:Gamepad| be the {{Gamepad}} instance in |navigator:Navigator|.{{[[gamepads]]}} representing the gamepad.
+        <li>Let |axisValues:sequence&lt;unsigned long&gt;| be the gamepad's <a>ordered array of logical axis input values</a>.
+        <li>Let |buttonValues:sequence&lt;unsigned long&gt;| be the gamepad's <a>ordered array of logical button input values</a>.
+        <li>Queue a task (where?) to <a>update gamepad state</a> for |gamepad| with |axisValues| and |buttonValues|.
+      </ol>
+      To <dfn>update gamepad state</dfn> for |gamepad| with an <a>ordered array of logical axis input values</a> |axisValues:sequence&lt;unsigned long&gt;| and an <a>ordered array of logical button input values</a> |buttonValues:sequence&lt;unsigned long&gt;|, run the following steps:
+      <ol>
+        <li>Let |now:DOMHighResTimeStamp| be a {{DOMHighResTimeStamp}} representing the current time.
+        <li>Let |gamepadsStart:DOMHighResTimeStamp| be the |navigationStart:DOMHighResTimeStamp| attribute of the {{PerformanceTiming}} interface.
+        <li>Set |gamepad|.{{Gamepad/timestamp}} to |now| − |gamepadsStart|.
+        <li>Let |axisCount:long| be the length of |axisValues|.
+        <li>Initialize |rawAxisIndex:long| to be 0.
+        <li>While |rawAxisIndex| < |axisCount|:
+          <ol>
+            <li>Let |mappedIndex:long| be the value for key |rawAxisIndex| in |gamepad|.{{[[axisMapping]]}}.

I've replaced the "value for key..." language with ordered map syntax but decided not to pull out |mapping|, maybe I should add it for readability? WDYT?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/gamepad/pull/151#discussion_r665766544

Received on Wednesday, 7 July 2021 23:23:01 UTC