pxt-common-packages 12.2.6 → 12.2.7
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/libs/azureiot/built/debug/binary.js +485 -485
- package/libs/color/built/debug/binary.js +8 -8
- package/libs/color-sensor/built/debug/binary.js +8 -8
- package/libs/controller/built/debug/binary.js +8466 -8762
- package/libs/controller---none/built/debug/binary.js +8445 -8741
- package/libs/datalogger/built/debug/binary.js +63 -63
- package/libs/edge-connector/built/debug/binary.js +8 -8
- package/libs/esp32/built/debug/binary.js +486 -486
- package/libs/game/built/debug/binary.js +8358 -8654
- package/libs/game/physics.ts +51 -32
- package/libs/game/sprite.ts +1 -0
- package/libs/game/spritemap.ts +7 -3
- package/libs/game/sprites.ts +1 -0
- package/libs/lcd/built/debug/binary.js +8 -8
- package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
- package/libs/lora/built/debug/binary.js +8 -8
- package/libs/matrix-keypad/built/debug/binary.js +8 -8
- package/libs/mqtt/built/debug/binary.js +200 -200
- package/libs/multiplayer/player.ts +1 -1
- package/libs/net/built/debug/binary.js +200 -200
- package/libs/net-game/built/debug/binary.js +10507 -10803
- package/libs/palette/built/debug/binary.js +8249 -8545
- package/libs/pixel/built/debug/binary.js +8 -8
- package/libs/power/built/debug/binary.js +8 -8
- package/libs/proximity/built/debug/binary.js +8 -8
- package/libs/radio/built/debug/binary.js +8 -8
- package/libs/radio-broadcast/built/debug/binary.js +8 -8
- package/libs/rotary-encoder/built/debug/binary.js +8 -8
- package/libs/screen/built/debug/binary.js +50 -50
- package/libs/servo/built/debug/binary.js +8 -8
- package/libs/sprite-scaling/built/debug/binary.js +8249 -8545
- package/libs/storyboard/built/debug/binary.js +8249 -8545
- package/package.json +1 -1
package/libs/game/physics.ts
CHANGED
|
@@ -189,7 +189,7 @@ class ArcadePhysicsEngine extends PhysicsEngine {
|
|
|
189
189
|
s._x = Fx.add(s._x, stepX);
|
|
190
190
|
s._y = Fx.add(s._y, stepY);
|
|
191
191
|
|
|
192
|
-
if (!(s.flags & SPRITE_NO_SPRITE_OVERLAPS)) {
|
|
192
|
+
if (!(s.flags & SPRITE_NO_SPRITE_OVERLAPS) && s._kindsOverlappedWith.length) {
|
|
193
193
|
this.map.insertAABB(s);
|
|
194
194
|
}
|
|
195
195
|
if (tileMap && tileMap.enabled) {
|
|
@@ -311,43 +311,62 @@ class ArcadePhysicsEngine extends PhysicsEngine {
|
|
|
311
311
|
control.enablePerfCounter("phys_collisions");
|
|
312
312
|
if (!handlers.length) return;
|
|
313
313
|
|
|
314
|
-
//
|
|
315
|
-
for (const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
314
|
+
// clear the overlap lists on all sprites
|
|
315
|
+
for (const sprite of this.sprites) {
|
|
316
|
+
sprite._alreadyChecked = undefined;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
for (const bucket of this.map.filledBuckets) {
|
|
320
|
+
if (bucket.length === 1) continue;
|
|
321
|
+
|
|
322
|
+
for (const sprite of bucket) {
|
|
323
|
+
if (sprite.flags & SPRITE_NO_SPRITE_OVERLAPS) continue;
|
|
324
|
+
|
|
325
|
+
for (const overlapper of bucket) {
|
|
326
|
+
if (overlapper === sprite) continue;
|
|
327
|
+
const thisKind = sprite.kind();
|
|
328
|
+
const otherKind = overlapper.kind();
|
|
329
|
+
|
|
330
|
+
// the sprite with the higher id maintains the overlap lists
|
|
331
|
+
const higher = sprite.id > overlapper.id ? sprite : overlapper;
|
|
332
|
+
const lower = higher === sprite ? overlapper : sprite;
|
|
333
|
+
|
|
334
|
+
if (!higher._alreadyChecked) {
|
|
335
|
+
higher._alreadyChecked = [];
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// skip if we already compared these two
|
|
339
|
+
if (higher._alreadyChecked.indexOf(lower.id) !== -1) continue;
|
|
340
|
+
|
|
341
|
+
higher._alreadyChecked.push(lower.id);
|
|
342
|
+
|
|
343
|
+
// skip if already overlapping
|
|
344
|
+
if (higher._overlappers.indexOf(lower.id) !== -1) continue;
|
|
345
|
+
|
|
346
|
+
// skip if there is no overlap event between these two kinds of sprites
|
|
347
|
+
if (sprite._kindsOverlappedWith.indexOf(otherKind) === -1) continue;
|
|
348
|
+
|
|
349
|
+
// perform the actual overlap check
|
|
350
|
+
if (!higher.overlapsWith(lower)) continue;
|
|
351
|
+
|
|
352
|
+
// invoke all matching overlap event handlers
|
|
353
|
+
for (const h of handlers) {
|
|
354
|
+
if ((h.kind === thisKind && h.otherKind === otherKind)
|
|
355
|
+
|| (h.kind === otherKind && h.otherKind === thisKind)) {
|
|
340
356
|
higher._overlappers.push(lower.id);
|
|
341
357
|
control.runInParallel(() => {
|
|
342
358
|
if (!((sprite.flags | overlapper.flags) & SPRITE_NO_SPRITE_OVERLAPS)) {
|
|
343
|
-
h.
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
359
|
+
if (thisKind === h.kind) {
|
|
360
|
+
h.handler(sprite, overlapper)
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
h.handler(overlapper, sprite)
|
|
364
|
+
}
|
|
347
365
|
}
|
|
348
366
|
higher._overlappers.removeElement(lower.id);
|
|
349
367
|
});
|
|
350
|
-
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
351
370
|
}
|
|
352
371
|
}
|
|
353
372
|
}
|
package/libs/game/sprite.ts
CHANGED
package/libs/game/spritemap.ts
CHANGED
|
@@ -5,6 +5,7 @@ namespace sprites {
|
|
|
5
5
|
private rowCount: number;
|
|
6
6
|
private columnCount: number;
|
|
7
7
|
private buckets: Sprite[][];
|
|
8
|
+
filledBuckets: Sprite[][];
|
|
8
9
|
|
|
9
10
|
constructor() {
|
|
10
11
|
this.buckets = [];
|
|
@@ -64,14 +65,15 @@ namespace sprites {
|
|
|
64
65
|
const areaWidth = tMap ? tMap.areaWidth() : screen.width;
|
|
65
66
|
const areaHeight = tMap ? tMap.areaHeight() : screen.height;
|
|
66
67
|
|
|
67
|
-
this.cellWidth = Math.clamp(8, areaWidth >> 2, maxWidth
|
|
68
|
-
this.cellHeight = Math.clamp(8, areaHeight >> 2, maxHeight
|
|
68
|
+
this.cellWidth = Math.clamp(8, areaWidth >> 2, maxWidth << 1);
|
|
69
|
+
this.cellHeight = Math.clamp(8, areaHeight >> 2, maxHeight << 1);
|
|
69
70
|
this.rowCount = Math.idiv(areaHeight, this.cellHeight);
|
|
70
71
|
this.columnCount = Math.idiv(areaWidth, this.cellWidth);
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
clear() {
|
|
74
75
|
this.buckets = [];
|
|
76
|
+
this.filledBuckets = [];
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
private key(x: number, y: number): number {
|
|
@@ -83,8 +85,10 @@ namespace sprites {
|
|
|
83
85
|
private insertAtKey(x: number, y: number, sprite: Sprite) {
|
|
84
86
|
const k = this.key(x, y);
|
|
85
87
|
let bucket = this.buckets[k];
|
|
86
|
-
if (!bucket)
|
|
88
|
+
if (!bucket) {
|
|
87
89
|
bucket = this.buckets[k] = [];
|
|
90
|
+
this.filledBuckets.push(bucket);
|
|
91
|
+
}
|
|
88
92
|
if (bucket.indexOf(sprite) < 0)
|
|
89
93
|
bucket.push(sprite);
|
|
90
94
|
}
|
package/libs/game/sprites.ts
CHANGED
|
@@ -56,6 +56,7 @@ namespace sprites {
|
|
|
56
56
|
//% blockAliasFor="sprites.create"
|
|
57
57
|
//% expandableArgumentMode=toggle
|
|
58
58
|
//% weight=99 help=sprites/create
|
|
59
|
+
//% duplicateShadowOnDrag
|
|
59
60
|
export function __create(img: Image, kind?: number): Sprite {
|
|
60
61
|
return sprites.create(img, kind);
|
|
61
62
|
}
|
|
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
|
|
|
56
56
|
const pxsim_numops = pxsim.numops;
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
function
|
|
59
|
+
function _main___P48753(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.
|
|
70
|
-
globals.
|
|
69
|
+
globals._intervals___48996 = (undefined);
|
|
70
|
+
globals._pollEventQueue___49009 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P48753.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P48753.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P48753_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P48753, 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___P48805_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P48753
|
|
92
92
|
})
|
|
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
|
|
|
56
56
|
const pxsim_numops = pxsim.numops;
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
function
|
|
59
|
+
function _main___P98602(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.
|
|
70
|
-
globals.
|
|
69
|
+
globals._intervals___98845 = (undefined);
|
|
70
|
+
globals._pollEventQueue___98858 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P98602.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P98602.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P98602_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P98602, 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___P98758_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P98602
|
|
92
92
|
})
|
|
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
|
|
|
56
56
|
const pxsim_numops = pxsim.numops;
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
function
|
|
59
|
+
function _main___P60066(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.
|
|
70
|
-
globals.
|
|
69
|
+
globals._intervals___60309 = (undefined);
|
|
70
|
+
globals._pollEventQueue___60322 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P60066.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P60066.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P60066_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P60066, 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___P60118_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P60066
|
|
92
92
|
})
|
|
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
|
|
|
56
56
|
const pxsim_numops = pxsim.numops;
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
function
|
|
59
|
+
function _main___P192086(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.
|
|
70
|
-
globals.
|
|
69
|
+
globals._intervals___192329 = (undefined);
|
|
70
|
+
globals._pollEventQueue___192342 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P192086.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P192086.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P192086_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P192086, 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___P192450_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P192086
|
|
92
92
|
})
|