pxt-arcade 1.10.4 → 1.10.5
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.
- package/built/sim.js +29 -0
- package/built/target.js +68 -68
- package/built/target.json +68 -68
- package/built/targetlight.json +4 -4
- package/package.json +1 -1
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 = {}));
|