pxt-common-packages 10.1.8 → 10.1.11

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 (38) hide show
  1. package/built/common-sim.js +2 -2
  2. package/libs/azureiot/built/debug/binary.js +461 -461
  3. package/libs/base/core.cpp +13 -1
  4. package/libs/base/gc.cpp +1 -0
  5. package/libs/color/built/debug/binary.js +8 -8
  6. package/libs/color-sensor/built/debug/binary.js +8 -8
  7. package/libs/controller/built/debug/binary.js +8032 -7916
  8. package/libs/controller---none/built/debug/binary.js +8011 -7895
  9. package/libs/datalogger/built/debug/binary.js +63 -63
  10. package/libs/edge-connector/built/debug/binary.js +8 -8
  11. package/libs/esp32/built/debug/binary.js +462 -462
  12. package/libs/game/built/debug/binary.js +7924 -7808
  13. package/libs/game/camera.ts +3 -4
  14. package/libs/game/physics.ts +30 -0
  15. package/libs/game/sprite.ts +0 -22
  16. package/libs/game---light/compat.ts +10 -0
  17. package/libs/game---light/pxt.json +1 -3
  18. package/libs/lcd/built/debug/binary.js +8 -8
  19. package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
  20. package/libs/lora/built/debug/binary.js +8 -8
  21. package/libs/matrix-keypad/built/debug/binary.js +8 -8
  22. package/libs/mqtt/built/debug/binary.js +176 -176
  23. package/libs/net/built/debug/binary.js +176 -176
  24. package/libs/net-game/built/debug/binary.js +9712 -9596
  25. package/libs/palette/built/debug/binary.js +7923 -7807
  26. package/libs/pixel/built/debug/binary.js +8 -8
  27. package/libs/power/built/debug/binary.js +8 -8
  28. package/libs/proximity/built/debug/binary.js +8 -8
  29. package/libs/radio/built/debug/binary.js +8 -8
  30. package/libs/radio-broadcast/built/debug/binary.js +8 -8
  31. package/libs/rotary-encoder/built/debug/binary.js +8 -8
  32. package/libs/screen/built/debug/binary.js +50 -50
  33. package/libs/screen/sim/image.ts +2 -2
  34. package/libs/screen---st7735/screen.cpp +7 -0
  35. package/libs/servo/built/debug/binary.js +8 -8
  36. package/libs/sprite-scaling/built/debug/binary.js +7923 -7807
  37. package/libs/storyboard/built/debug/binary.js +7923 -7807
  38. package/package.json +1 -1
@@ -67,7 +67,7 @@ namespace scene {
67
67
  if (amplitude <= 0 || duration <= 0) {
68
68
  this.shakeStartTime = undefined;
69
69
  } else {
70
- // this overrides any existing shake operation
70
+ // this overrides any existing shake operation
71
71
  this.shakeStartTime = control.millis();
72
72
  this.shakeAmplitude = amplitude;
73
73
  this.shakeDuration = duration;
@@ -82,9 +82,8 @@ namespace scene {
82
82
  this.offsetY = this.sprite.y - (screen.height >> 1);
83
83
  }
84
84
 
85
- // normalize offset
86
- this.offsetX |= 0;
87
- this.offsetY |= 0;
85
+ this.offsetX = Math.floor(this.offsetX);
86
+ this.offsetY = Math.floor(this.offsetY);
88
87
 
89
88
  this.drawOffsetX = this.offsetX;
90
89
  this.drawOffsetY = this.offsetY;
@@ -195,6 +195,13 @@ class ArcadePhysicsEngine extends PhysicsEngine {
195
195
  if (tileMap && tileMap.enabled) {
196
196
  this.tilemapCollisions(ms, tileMap);
197
197
  }
198
+
199
+ // check for screen edge collisions
200
+ const bounce = s.flags & sprites.Flag.BounceOnWall;
201
+ if (s.flags & sprites.Flag.StayInScreen || (bounce && !tileMap)) {
202
+ this.screenEdgeCollisions(ms, bounce, scene.camera);
203
+ }
204
+
198
205
  // if sprite still needs to move, add it to the next step of movements
199
206
  if (Fx.abs(ms.dx) > MIN_MOVE_GAP || Fx.abs(ms.dy) > MIN_MOVE_GAP) {
200
207
  remainingMovers.push(ms);
@@ -346,6 +353,29 @@ class ArcadePhysicsEngine extends PhysicsEngine {
346
353
  }
347
354
  }
348
355
 
356
+ protected screenEdgeCollisions(movingSprite: MovingSprite, bounce: number, camera: scene.Camera) {
357
+ let s = movingSprite.sprite;
358
+ if (!s.isStatic()) s.setHitbox();
359
+
360
+ let offset = Fx.toFloat(s._hitbox.left) - camera.offsetX;
361
+ if (offset < 0) {
362
+ s.left -= offset;
363
+ if (bounce) s.vx = -s.vx;
364
+ }
365
+ else if ((offset = Fx.toFloat(s._hitbox.right) - camera.offsetX - screen.width) > 0) {
366
+ s.right -= offset;
367
+ if (bounce) s.vx = -s.vx;
368
+ }
369
+ if ((offset = Fx.toFloat(s._hitbox.top) - camera.offsetY) < 0) {
370
+ s.top -= offset;
371
+ if (bounce) s.vy = -s.vy;
372
+ }
373
+ else if ((offset = Fx.toFloat(s._hitbox.bottom) - camera.offsetY - screen.height) > 0) {
374
+ s.bottom -= offset;
375
+ if (bounce) s.vy = -s.vy;
376
+ }
377
+ }
378
+
349
379
  protected tilemapCollisions(movingSprite: MovingSprite, tm: tiles.TileMap) {
350
380
  const s = movingSprite.sprite;
351
381
  // if the sprite is already clipping into a wall,
@@ -639,28 +639,6 @@ class Sprite extends sprites.BaseSprite {
639
639
  this.destroy()
640
640
  }
641
641
 
642
- const bounce = this.flags & sprites.Flag.BounceOnWall;
643
- const tm = game.currentScene().tileMap;
644
- if (this.flags & sprites.Flag.StayInScreen || (bounce && !tm)) {
645
- if (this.left < camera.offsetX) {
646
- this.left = camera.offsetX;
647
- if (bounce) this.vx = -this.vx;
648
- }
649
- else if (this.right > camera.offsetX + screen.width) {
650
- this.right = camera.offsetX + screen.width;
651
- if (bounce) this.vx = -this.vx;
652
- }
653
-
654
- if (this.top < camera.offsetY) {
655
- this.top = camera.offsetY;
656
- if (bounce) this.vy = -this.vy;
657
- }
658
- else if (this.bottom > camera.offsetY + screen.height) {
659
- this.bottom = camera.offsetY + screen.height;
660
- if (bounce) this.vy = -this.vy;
661
- }
662
- }
663
-
664
642
  if (this.sayRenderer) this.sayRenderer.update(dt, camera, this);
665
643
  }
666
644
 
@@ -4,6 +4,10 @@ namespace scene.systemMenu {
4
4
  }
5
5
  }
6
6
 
7
+ namespace power {
8
+ export function poke() {}
9
+ }
10
+
7
11
  namespace scene {
8
12
  export const SCREEN_CLEAR_PRIORITY = 1;
9
13
  export const UPDATE_INTERVAL_PRIORITY = 19;
@@ -20,6 +24,12 @@ class Scene {
20
24
  millis() {
21
25
  return control.millis()
22
26
  }
27
+
28
+ constructor() {
29
+ this.buttonEventHandlers = []
30
+ }
31
+
32
+ buttonEventHandlers: controller.ButtonEventHandlerState[];
23
33
  }
24
34
 
25
35
  namespace game {
@@ -17,8 +17,6 @@
17
17
  "additionalFilePath": "../game",
18
18
  "dependencies": {
19
19
  "settings": "file:../settings",
20
- "screen": "file:../screen",
21
- "mixer": "file:../mixer",
22
- "power": "file:../power"
20
+ "screen": "file:../screen"
23
21
  }
24
22
  }
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P48261(s) {
59
+ function _main___P48318(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___48504 = (undefined);
70
- globals._pollEventQueue___48517 = (undefined);
69
+ globals._intervals___48561 = (undefined);
70
+ globals._pollEventQueue___48574 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P48261.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P48261.continuations = [ ]
75
+ _main___P48318.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P48318.continuations = [ ]
77
77
 
78
- function _main___P48261_mk(s) {
78
+ function _main___P48318_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P48261, depth: s.depth + 1,
81
+ parent: s, fn: _main___P48318, 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___P48261_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P48261
91
+ return _main___P48318
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___P97115(s) {
59
+ function _main___P97286(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___97358 = (undefined);
70
- globals._pollEventQueue___97371 = (undefined);
69
+ globals._intervals___97529 = (undefined);
70
+ globals._pollEventQueue___97542 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P97115.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P97115.continuations = [ ]
75
+ _main___P97286.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P97286.continuations = [ ]
77
77
 
78
- function _main___P97115_mk(s) {
78
+ function _main___P97286_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P97115, depth: s.depth + 1,
81
+ parent: s, fn: _main___P97286, 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___P97115_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P97115
91
+ return _main___P97286
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___P59563(s) {
59
+ function _main___P59620(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___59806 = (undefined);
70
- globals._pollEventQueue___59819 = (undefined);
69
+ globals._intervals___59863 = (undefined);
70
+ globals._pollEventQueue___59876 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P59563.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P59563.continuations = [ ]
75
+ _main___P59620.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P59620.continuations = [ ]
77
77
 
78
- function _main___P59563_mk(s) {
78
+ function _main___P59620_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P59563, depth: s.depth + 1,
81
+ parent: s, fn: _main___P59620, 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___P59563_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P59563
91
+ return _main___P59620
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___P188347(s) {
59
+ function _main___P188746(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___188590 = (undefined);
70
- globals._pollEventQueue___188603 = (undefined);
69
+ globals._intervals___188989 = (undefined);
70
+ globals._pollEventQueue___189002 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P188347.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P188347.continuations = [ ]
75
+ _main___P188746.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P188746.continuations = [ ]
77
77
 
78
- function _main___P188347_mk(s) {
78
+ function _main___P188746_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P188347, depth: s.depth + 1,
81
+ parent: s, fn: _main___P188746, 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___P188347_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P188347
91
+ return _main___P188746
92
92
  })