pxt-common-packages 10.3.13 → 10.3.14

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.
Files changed (32) hide show
  1. package/built/common-sim.js +4 -2
  2. package/libs/azureiot/built/debug/binary.js +461 -461
  3. package/libs/color/built/debug/binary.js +8 -8
  4. package/libs/color-sensor/built/debug/binary.js +8 -8
  5. package/libs/controller/built/debug/binary.js +8417 -8204
  6. package/libs/controller---none/built/debug/binary.js +8402 -8189
  7. package/libs/datalogger/built/debug/binary.js +63 -63
  8. package/libs/edge-connector/built/debug/binary.js +8 -8
  9. package/libs/esp32/built/debug/binary.js +462 -462
  10. package/libs/game/built/debug/binary.js +8303 -8090
  11. package/libs/game/controller.ts +24 -0
  12. package/libs/game/scene.ts +1 -0
  13. package/libs/game/sim/multiplayer.ts +5 -2
  14. package/libs/lcd/built/debug/binary.js +8 -8
  15. package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
  16. package/libs/lora/built/debug/binary.js +8 -8
  17. package/libs/matrix-keypad/built/debug/binary.js +8 -8
  18. package/libs/mqtt/built/debug/binary.js +176 -176
  19. package/libs/net/built/debug/binary.js +176 -176
  20. package/libs/net-game/built/debug/binary.js +10110 -9897
  21. package/libs/palette/built/debug/binary.js +8302 -8089
  22. package/libs/pixel/built/debug/binary.js +8 -8
  23. package/libs/power/built/debug/binary.js +8 -8
  24. package/libs/proximity/built/debug/binary.js +8 -8
  25. package/libs/radio/built/debug/binary.js +8 -8
  26. package/libs/radio-broadcast/built/debug/binary.js +8 -8
  27. package/libs/rotary-encoder/built/debug/binary.js +8 -8
  28. package/libs/screen/built/debug/binary.js +50 -50
  29. package/libs/servo/built/debug/binary.js +8 -8
  30. package/libs/sprite-scaling/built/debug/binary.js +8302 -8089
  31. package/libs/storyboard/built/debug/binary.js +8302 -8089
  32. package/package.json +1 -1
@@ -13,6 +13,30 @@ enum ControllerEvent {
13
13
  //% blockGap=8
14
14
  namespace controller {
15
15
  let _players: Controller[];
16
+ game.addScenePopHandler(() => {
17
+ const stateWhenPushed = game.currentScene().controllerConnectionState;
18
+ if (!stateWhenPushed)
19
+ return;
20
+ for (let i = 0; i < stateWhenPushed.length; i++) {
21
+ const p = _players[i];
22
+ if (p && (!!stateWhenPushed[i] != !!p.connected)) {
23
+ // connection state changed while in another scene; raise the event.
24
+ control.raiseEvent(
25
+ p.id,
26
+ p.connected ? ControllerEvent.Connected : ControllerEvent.Disconnected
27
+ );
28
+ }
29
+ }
30
+
31
+ })
32
+ game.addScenePushHandler(oldScene => {
33
+ oldScene.controllerConnectionState = [];
34
+ for (let i = 0; i < _players.length; i++) {
35
+ if (_players[i]) {
36
+ oldScene.controllerConnectionState[i] = _players[i].connected;
37
+ }
38
+ }
39
+ })
16
40
 
17
41
  function addController(ctrl: Controller) {
18
42
  if (!_players) {
@@ -94,6 +94,7 @@ namespace scene {
94
94
  gameForeverHandlers: GameForeverHandler[];
95
95
  particleSources: particles.ParticleSource[];
96
96
  controlledSprites: controller.ControlledSprite[][];
97
+ controllerConnectionState: boolean[]
97
98
  followingSprites: sprites.FollowingSprite[];
98
99
  buttonEventHandlers: controller.ButtonEventHandlerState[];
99
100
 
@@ -17,11 +17,14 @@ namespace pxsim.multiplayer {
17
17
  }
18
18
 
19
19
  export function postIcon(iconType: IconType, slot: number, im: pxsim.RefImage) {
20
- if (im._width * im._height > 64 * 64) {
20
+ if (im && (im._width * im._height > 64 * 64)) {
21
21
  // setting 64x64 as max size for icon for now
22
22
  return;
23
23
  }
24
- const asBuf = pxsim.image.toBuffer(im);
24
+
25
+ // treat empty icon as undefined
26
+ const asBuf = (im && im.data.some(pixel => pixel != 0))
27
+ ? pxsim.image.toBuffer(im) : undefined;
25
28
  const sb = board() as ScreenBoard;
26
29
  const screenState = sb && sb.screenState;
27
30
  getMultiplayerState().send({
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P48757(s) {
59
+ function _main___P48823(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___49000 = (undefined);
70
- globals._pollEventQueue___49013 = (undefined);
69
+ globals._intervals___49066 = (undefined);
70
+ globals._pollEventQueue___49079 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P48757.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P48757.continuations = [ ]
75
+ _main___P48823.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P48823.continuations = [ ]
77
77
 
78
- function _main___P48757_mk(s) {
78
+ function _main___P48823_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P48757, depth: s.depth + 1,
81
+ parent: s, fn: _main___P48823, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P48757_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P48757
91
+ return _main___P48823
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P98603(s) {
59
+ function _main___P98801(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___98846 = (undefined);
70
- globals._pollEventQueue___98859 = (undefined);
69
+ globals._intervals___99044 = (undefined);
70
+ globals._pollEventQueue___99057 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P98603.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P98603.continuations = [ ]
75
+ _main___P98801.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P98801.continuations = [ ]
77
77
 
78
- function _main___P98603_mk(s) {
78
+ function _main___P98801_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P98603, depth: s.depth + 1,
81
+ parent: s, fn: _main___P98801, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P98603_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P98603
91
+ return _main___P98801
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P60059(s) {
59
+ function _main___P60125(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___60302 = (undefined);
70
- globals._pollEventQueue___60315 = (undefined);
69
+ globals._intervals___60368 = (undefined);
70
+ globals._pollEventQueue___60381 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P60059.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P60059.continuations = [ ]
75
+ _main___P60125.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P60125.continuations = [ ]
77
77
 
78
- function _main___P60059_mk(s) {
78
+ function _main___P60125_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P60059, depth: s.depth + 1,
81
+ parent: s, fn: _main___P60125, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P60059_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P60059
91
+ return _main___P60125
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P191819(s) {
59
+ function _main___P192281(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___192062 = (undefined);
70
- globals._pollEventQueue___192075 = (undefined);
69
+ globals._intervals___192524 = (undefined);
70
+ globals._pollEventQueue___192537 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P191819.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P191819.continuations = [ ]
75
+ _main___P192281.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P192281.continuations = [ ]
77
77
 
78
- function _main___P191819_mk(s) {
78
+ function _main___P192281_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P191819, depth: s.depth + 1,
81
+ parent: s, fn: _main___P192281, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P191819_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P191819
91
+ return _main___P192281
92
92
  })