From f0bf4564d48938703529e3364a01e2661f565783 Mon Sep 17 00:00:00 2001 From: Matt Reynolds Date: Thu, 8 Dec 2022 15:00:44 -0800 Subject: [PATCH 1/3] Update getGamepads to include steps for copying gamepads --- index.html | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 2bc705e..ca4ea3c 100644 --- a/index.html +++ b/index.html @@ -1128,15 +1128,56 @@

  • Let |now:DOMHighResTimeStamp| be the [=current high resolution time=].
  • +
  • Let |gamepads| be a new [=list=]. +
  • [=list/For each=] |gamepad:Gamepad| of [=this=].{{Navigator/[[gamepads]]}}:
      -
    1. If |gamepad| is not `null` and - |gamepad|.{{Gamepad/[[exposed]]}} is `false`: +
    2. If |gamepad| is `null` or |gamepad|.{{Gamepad/[[exposed]]}} is `false`, [=list/append=] `null` to |gamepads|. +
    3. +
    4. Otherwise:
        -
      1. Set |gamepad|.{{Gamepad/[[exposed]]}} to `true`. +
      2. Let |axesCopy| be a new [=list=]. +
      3. +
      4. [=list/For each=] |axis| of |gamepad|.{{Gamepad/[[axes]]}}, [=list/append=] |axis| to |axesCopy|. +
      5. +
      6. Let |buttonsCopy| be a new [=list=]. +
      7. +
      8. [=list/For each=] |button| of |gamepad|.{{Gamepad/[[buttons]]}}: +
          +
        1. Let |buttonCopy| be a newly created {{GamepadButton}} instance: +
            +
          1. Initialize |buttonCopy|.{{GamepadButton/pressed}} to |button|.{{GamepadButton/pressed}}. +
          2. +
          3. Initialize |buttonCopy|.{{GamepadButton/touched}} to |button|.{{GamepadButton/touched}}. +
          4. +
          5. Initialize |buttonCopy|.{{GamepadButton/value}} to |button|.{{GamepadButton/value}}. +
          6. +
          +
        2. +
        3. [=list/Append=] |buttonCopy| to |buttonsCopy|. +
        4. +
        +
      9. +
      10. Let |gamepadCopy:Gamepad| be a newly created {{Gamepad}} instance: +
          +
        1. Initialize |gamepadCopy|'s {{Gamepad/id}} attribute to |gamepad|.{{Gamepad/id}}. +
        2. +
        3. Initialize |gamepadCopy|'s {{Gamepad/index}} attribute to |gamepad|.{{Gamepad/index}}. +
        4. +
        5. Initialize |gamepadCopy|'s {{Gamepad/mapping}} attribute to |gamepad|.{{Gamepad/mapping}}. +
        6. +
        7. Initialize |gamepadCopy|.{{Gamepad/[[connected]]}} to |gamepad|.{{Gamepad/[[connected]]}}. +
        8. +
        9. Initialize |gamepadCopy|.{{Gamepad/[[timestamp]]}} to |gamepad|.{{Gamepad/[[timestamp]]}}. +
        10. +
        11. Initialize |gamepadCopy|.{{Gamepad/[[axes]]}} to |axesCopy|. +
        12. +
        13. Initialize |gamepadCopy|.{{Gamepad/[[buttons]]}} to |buttonsCopy]. +
        14. +
      11. -
      12. Set |gamepad|.{{Gamepad/[[timestamp]]}} to |now|. +
      13. [=list/Append=] |gamepadCopy| to |gamepads|.
    5. From 856fcc89de00bbd6f8b5949ae71c1db29a5e4a2a Mon Sep 17 00:00:00 2001 From: Matt Reynolds Date: Thu, 8 Dec 2022 15:04:08 -0800 Subject: [PATCH 2/3] tidy --- index.html | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/index.html b/index.html index ca4ea3c..b6059e6 100644 --- a/index.html +++ b/index.html @@ -1133,25 +1133,33 @@

    6. [=list/For each=] |gamepad:Gamepad| of [=this=].{{Navigator/[[gamepads]]}}:
        -
      1. If |gamepad| is `null` or |gamepad|.{{Gamepad/[[exposed]]}} is `false`, [=list/append=] `null` to |gamepads|. +
      2. If |gamepad| is `null` or |gamepad|.{{Gamepad/[[exposed]]}} + is `false`, [=list/append=] `null` to |gamepads|.
      3. Otherwise:
        1. Let |axesCopy| be a new [=list=].
        2. -
        3. [=list/For each=] |axis| of |gamepad|.{{Gamepad/[[axes]]}}, [=list/append=] |axis| to |axesCopy|. +
        4. [=list/For each=] |axis| of + |gamepad|.{{Gamepad/[[axes]]}}, [=list/append=] |axis| to + |axesCopy|.
        5. Let |buttonsCopy| be a new [=list=].
        6. -
        7. [=list/For each=] |button| of |gamepad|.{{Gamepad/[[buttons]]}}: +
        8. [=list/For each=] |button| of + |gamepad|.{{Gamepad/[[buttons]]}}:
            -
          1. Let |buttonCopy| be a newly created {{GamepadButton}} instance: +
          2. Let |buttonCopy| be a newly created {{GamepadButton}} + instance:
              -
            1. Initialize |buttonCopy|.{{GamepadButton/pressed}} to |button|.{{GamepadButton/pressed}}. +
            2. Initialize |buttonCopy|.{{GamepadButton/pressed}} + to |button|.{{GamepadButton/pressed}}.
            3. -
            4. Initialize |buttonCopy|.{{GamepadButton/touched}} to |button|.{{GamepadButton/touched}}. +
            5. Initialize |buttonCopy|.{{GamepadButton/touched}} + to |button|.{{GamepadButton/touched}}.
            6. -
            7. Initialize |buttonCopy|.{{GamepadButton/value}} to |button|.{{GamepadButton/value}}. +
            8. Initialize |buttonCopy|.{{GamepadButton/value}} + to |button|.{{GamepadButton/value}}.
          3. @@ -1159,21 +1167,29 @@

        9. -
        10. Let |gamepadCopy:Gamepad| be a newly created {{Gamepad}} instance: +
        11. Let |gamepadCopy:Gamepad| be a newly created {{Gamepad}} + instance:
            -
          1. Initialize |gamepadCopy|'s {{Gamepad/id}} attribute to |gamepad|.{{Gamepad/id}}. +
          2. Initialize |gamepadCopy|'s {{Gamepad/id}} attribute + to |gamepad|.{{Gamepad/id}}.
          3. -
          4. Initialize |gamepadCopy|'s {{Gamepad/index}} attribute to |gamepad|.{{Gamepad/index}}. +
          5. Initialize |gamepadCopy|'s {{Gamepad/index}} + attribute to |gamepad|.{{Gamepad/index}}.
          6. -
          7. Initialize |gamepadCopy|'s {{Gamepad/mapping}} attribute to |gamepad|.{{Gamepad/mapping}}. +
          8. Initialize |gamepadCopy|'s {{Gamepad/mapping}} + attribute to |gamepad|.{{Gamepad/mapping}}.
          9. -
          10. Initialize |gamepadCopy|.{{Gamepad/[[connected]]}} to |gamepad|.{{Gamepad/[[connected]]}}. +
          11. Initialize |gamepadCopy|.{{Gamepad/[[connected]]}} to + |gamepad|.{{Gamepad/[[connected]]}}.
          12. -
          13. Initialize |gamepadCopy|.{{Gamepad/[[timestamp]]}} to |gamepad|.{{Gamepad/[[timestamp]]}}. +
          14. Initialize |gamepadCopy|.{{Gamepad/[[timestamp]]}} to + |gamepad|.{{Gamepad/[[timestamp]]}}.
          15. -
          16. Initialize |gamepadCopy|.{{Gamepad/[[axes]]}} to |axesCopy|. +
          17. Initialize |gamepadCopy|.{{Gamepad/[[axes]]}} to + |axesCopy|.
          18. -
          19. Initialize |gamepadCopy|.{{Gamepad/[[buttons]]}} to |buttonsCopy]. +
          20. Initialize |gamepadCopy|.{{Gamepad/[[buttons]]}} to + |buttonsCopy].
        12. From c63515348bcae81d34a5b63731ebb93b6d76110c Mon Sep 17 00:00:00 2001 From: Matt Reynolds Date: Thu, 14 Sep 2023 14:12:34 +0200 Subject: [PATCH 3/3] Update index.html --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 511312d..c199f7f 100644 --- a/index.html +++ b/index.html @@ -627,13 +627,13 @@

          1. Let |gamepad:Gamepad| be a newly created {{Gamepad}} instance:
              -
            1. Initialize |gamepad|'s {{Gamepad/id}} attribute to an +
            2. Initialize |gamepad|.{{Gamepad/id}} to an identification string for the gamepad.
            3. -
            4. Initialize |gamepad|'s {{Gamepad/index}} attribute to the +
            5. Initialize |gamepad|.{{Gamepad/index}} to the result of [=selecting an unused gamepad index=] for |gamepad|.
            6. -
            7. Initialize |gamepad|'s {{Gamepad/mapping}} attribute to the +
            8. Initialize |gamepad|.{{Gamepad/mapping}} to the result of [=selecting a mapping=] for the gamepad device.
            9. Initialize |gamepad|.{{Gamepad/[[connected]]}} to `true`.