pxt-arcade 1.12.5 → 1.12.6

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.
@@ -774,6 +774,7 @@ declare namespace pxsim {
774
774
  }
775
775
  declare namespace pxsim.multiplayer {
776
776
  function postImage(im: pxsim.RefImage): void;
777
+ function postIcon(iconType: IconType, slot: number, im: pxsim.RefImage): void;
777
778
  function getCurrentImage(): pxsim.RefImage;
778
779
  function setOrigin(origin: "client" | "server" | undefined): void;
779
780
  function getOrigin(): string;
@@ -796,6 +797,17 @@ declare namespace pxsim {
796
797
  image: RefBuffer;
797
798
  palette: Uint8Array;
798
799
  }
800
+ enum IconType {
801
+ Player = 0,
802
+ Reaction = 1
803
+ }
804
+ interface MultiplayerIconMessage extends SimulatorMultiplayerMessage {
805
+ content: "Icon";
806
+ icon: RefBuffer;
807
+ slot: number;
808
+ iconType: IconType;
809
+ palette: Uint8Array;
810
+ }
799
811
  interface MultiplayerButtonEvent extends SimulatorMultiplayerMessage {
800
812
  content: "Button";
801
813
  button: number;
@@ -2553,6 +2553,25 @@ var pxsim;
2553
2553
  });
2554
2554
  }
2555
2555
  multiplayer.postImage = postImage;
2556
+ function postIcon(iconType, slot, im) {
2557
+ if (pxsim.getMultiplayerState().origin !== "server")
2558
+ return;
2559
+ if (im._width * im._height > 64 * 64) {
2560
+ // setting 64x64 as max size for icon for now
2561
+ return;
2562
+ }
2563
+ const asBuf = pxsim.image.toBuffer(im);
2564
+ const sb = pxsim.board();
2565
+ const screenState = sb && sb.screenState;
2566
+ pxsim.getMultiplayerState().send({
2567
+ content: "Icon",
2568
+ slot: slot,
2569
+ icon: asBuf,
2570
+ iconType: iconType,
2571
+ palette: screenState.paletteToUint8Array(),
2572
+ });
2573
+ }
2574
+ multiplayer.postIcon = postIcon;
2556
2575
  function getCurrentImage() {
2557
2576
  return pxsim.getMultiplayerState().backgroundImage;
2558
2577
  }
@@ -2572,6 +2591,11 @@ var pxsim;
2572
2591
  return pxsim.board().multiplayerState;
2573
2592
  }
2574
2593
  pxsim.getMultiplayerState = getMultiplayerState;
2594
+ let IconType;
2595
+ (function (IconType) {
2596
+ IconType[IconType["Player"] = 0] = "Player";
2597
+ IconType[IconType["Reaction"] = 1] = "Reaction";
2598
+ })(IconType = pxsim.IconType || (pxsim.IconType = {}));
2575
2599
  class MultiplayerState {
2576
2600
  constructor() {
2577
2601
  this.lastMessageId = 0;
package/built/sim.js CHANGED
@@ -2767,6 +2767,25 @@ var pxsim;
2767
2767
  });
2768
2768
  }
2769
2769
  multiplayer.postImage = postImage;
2770
+ function postIcon(iconType, slot, im) {
2771
+ if (pxsim.getMultiplayerState().origin !== "server")
2772
+ return;
2773
+ if (im._width * im._height > 64 * 64) {
2774
+ // setting 64x64 as max size for icon for now
2775
+ return;
2776
+ }
2777
+ const asBuf = pxsim.image.toBuffer(im);
2778
+ const sb = pxsim.board();
2779
+ const screenState = sb && sb.screenState;
2780
+ pxsim.getMultiplayerState().send({
2781
+ content: "Icon",
2782
+ slot: slot,
2783
+ icon: asBuf,
2784
+ iconType: iconType,
2785
+ palette: screenState.paletteToUint8Array(),
2786
+ });
2787
+ }
2788
+ multiplayer.postIcon = postIcon;
2770
2789
  function getCurrentImage() {
2771
2790
  return pxsim.getMultiplayerState().backgroundImage;
2772
2791
  }
@@ -2786,6 +2805,11 @@ var pxsim;
2786
2805
  return pxsim.board().multiplayerState;
2787
2806
  }
2788
2807
  pxsim.getMultiplayerState = getMultiplayerState;
2808
+ let IconType;
2809
+ (function (IconType) {
2810
+ IconType[IconType["Player"] = 0] = "Player";
2811
+ IconType[IconType["Reaction"] = 1] = "Reaction";
2812
+ })(IconType = pxsim.IconType || (pxsim.IconType = {}));
2789
2813
  class MultiplayerState {
2790
2814
  constructor() {
2791
2815
  this.lastMessageId = 0;