pxt-arcade 1.9.15 → 1.9.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2448,9 +2448,9 @@ var pxsim;
2448
2448
  // Player 1 keymap
2449
2449
  this.setPlayerKeys(1, // Player 1
2450
2450
  87, // W - Up
2451
- 83, // D - Down
2451
+ 83, // S - Down
2452
2452
  65, // A - Left
2453
- 83, // S - Right
2453
+ 68, // D - Right
2454
2454
  32, // Space - A
2455
2455
  13 // Enter - B
2456
2456
  );
@@ -2459,7 +2459,7 @@ var pxsim;
2459
2459
  73, // I - Up
2460
2460
  75, // K - Down
2461
2461
  74, // J - Left
2462
- 75, // K - Right
2462
+ 76, // L - Right
2463
2463
  85, // U - A
2464
2464
  79 // O - B
2465
2465
  );
@@ -2467,8 +2467,8 @@ var pxsim;
2467
2467
  // System keymap
2468
2468
  this.setSystemKeys(80, // P - Screenshot
2469
2469
  82, // R - Gif
2470
- 0, // Menu - not mapped
2471
- 0 // Reset - not mapped
2470
+ 192, // Menu - '`' (backtick) button
2471
+ 50 // Reset - Backspace button
2472
2472
  );
2473
2473
  // Player 1 alternate mapping. This is cleared when the game sets any player keys explicitly
2474
2474
  this.altmap[38] = Key.Up; // UpArrow
package/built/sim.js CHANGED
@@ -179,6 +179,12 @@ var pxsim;
179
179
  const key = (typeof e.which == "number") ? e.which : e.keyCode;
180
180
  b.setKey(key, true, e);
181
181
  }
182
+ pxsim.Runtime.postMessage({
183
+ type: "messagepacket",
184
+ broadcast: false,
185
+ channel: "keydown-" + e.key,
186
+ data: new Uint8Array()
187
+ });
182
188
  };
183
189
  window.onkeyup = function (e) {
184
190
  const b = board();
@@ -186,6 +192,12 @@ var pxsim;
186
192
  const key = (typeof e.which == "number") ? e.which : e.keyCode;
187
193
  b.setKey(key, false, e);
188
194
  }
195
+ pxsim.Runtime.postMessage({
196
+ type: "messagepacket",
197
+ broadcast: false,
198
+ channel: "keyup-" + e.key,
199
+ data: new Uint8Array()
200
+ });
189
201
  };
190
202
  window.oncontextmenu = function (e) {
191
203
  e.preventDefault();
@@ -433,6 +445,10 @@ var pxsim;
433
445
  pxsim.Board = Board;
434
446
  function indicateFocus(hasFocus) {
435
447
  document.getElementById("root").setAttribute("class", hasFocus ? "" : "blur");
448
+ const b = board();
449
+ if (b) {
450
+ b.gameplayer.indicateFocus(hasFocus);
451
+ }
436
452
  }
437
453
  pxsim.indicateFocus = indicateFocus;
438
454
  function throttleAnimation(event, handler) {
@@ -704,6 +720,9 @@ var pxsim;
704
720
  this.screen = document.getElementById("game-screen");
705
721
  this.menu = document.getElementsByClassName("game-menu-button")[0];
706
722
  this.reset = document.getElementsByClassName("game-reset-button")[0];
723
+ // TODO: localize; currently can't use lf in this repo
724
+ this.menu.setAttribute("aria-label", "Menu");
725
+ this.reset.setAttribute("aria-label", "Reset Game");
707
726
  if (this.menu) {
708
727
  this.menu.onclick = () => {
709
728
  visuals.pressButton(pxsim.Key.Menu);
@@ -778,6 +797,16 @@ var pxsim;
778
797
  }
779
798
  return false;
780
799
  }
800
+ indicateFocus(focused) {
801
+ if (focused) {
802
+ this.menu.setAttribute("aria-disabled", "false");
803
+ this.reset.setAttribute("aria-disabled", "false");
804
+ }
805
+ else {
806
+ this.menu.setAttribute("aria-disabled", "true");
807
+ this.reset.setAttribute("aria-disabled", "true");
808
+ }
809
+ }
781
810
  }
782
811
  visuals.GamePlayer = GamePlayer;
783
812
  })(visuals = pxsim.visuals || (pxsim.visuals = {}));
@@ -2520,9 +2549,9 @@ var pxsim;
2520
2549
  // Player 1 keymap
2521
2550
  this.setPlayerKeys(1, // Player 1
2522
2551
  87, // W - Up
2523
- 83, // D - Down
2552
+ 83, // S - Down
2524
2553
  65, // A - Left
2525
- 83, // S - Right
2554
+ 68, // D - Right
2526
2555
  32, // Space - A
2527
2556
  13 // Enter - B
2528
2557
  );
@@ -2531,7 +2560,7 @@ var pxsim;
2531
2560
  73, // I - Up
2532
2561
  75, // K - Down
2533
2562
  74, // J - Left
2534
- 75, // K - Right
2563
+ 76, // L - Right
2535
2564
  85, // U - A
2536
2565
  79 // O - B
2537
2566
  );
@@ -2539,8 +2568,8 @@ var pxsim;
2539
2568
  // System keymap
2540
2569
  this.setSystemKeys(80, // P - Screenshot
2541
2570
  82, // R - Gif
2542
- 0, // Menu - not mapped
2543
- 0 // Reset - not mapped
2571
+ 192, // Menu - '`' (backtick) button
2572
+ 50 // Reset - Backspace button
2544
2573
  );
2545
2574
  // Player 1 alternate mapping. This is cleared when the game sets any player keys explicitly
2546
2575
  this.altmap[38] = Key.Up; // UpArrow