pxt-common-packages 9.4.7 → 9.5.1
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/common-sim.d.ts +1 -0
- package/built/common-sim.js +3 -0
- package/libs/accelerometer/built/debug/binary.js +8 -8
- package/libs/azureiot/built/debug/binary.js +461 -461
- package/libs/base/fixed.ts +6 -0
- 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 +7636 -7598
- package/libs/controller---none/built/debug/binary.js +7617 -7579
- package/libs/core/built/debug/binary.js +2 -2
- package/libs/core---samd/built/debug/binary.js +8 -8
- 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 +462 -462
- package/libs/game/built/debug/binary.js +7530 -7492
- package/libs/game/hitbox.ts +5 -5
- package/libs/game/sprite.ts +9 -9
- package/libs/gamepad/built/debug/binary.js +8 -8
- package/libs/keyboard/built/debug/binary.js +8 -8
- package/libs/lcd/built/debug/binary.js +8 -8
- package/libs/light/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/microphone/built/debug/binary.js +8 -8
- package/libs/mouse/built/debug/binary.js +8 -8
- package/libs/mqtt/built/debug/binary.js +176 -176
- package/libs/music/built/debug/binary.js +8 -8
- package/libs/net/built/debug/binary.js +176 -176
- package/libs/net/controller.ts +10 -1
- package/libs/net-game/built/debug/binary.js +9286 -9248
- package/libs/palette/built/debug/binary.js +7529 -7491
- 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/pulse/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/_locales/sprite-scaling-strings.json +5 -7
- package/libs/sprite-scaling/built/debug/binary.js +7529 -7491
- package/libs/sprite-scaling/scaling.ts +51 -50
- package/libs/storyboard/built/debug/binary.js +7529 -7491
- package/libs/tests/built/debug/binary.js +15 -15
- package/libs/thermometer/built/debug/binary.js +8 -8
- package/libs/wifi---esp32/README.md +12 -0
- package/libs/wifi---esp32/buildlogin.sh +1 -0
- package/libs/wifi---esp32/controller.ts +27 -1
- package/libs/wifi---esp32/enums.d.ts +4 -0
- package/libs/wifi---esp32/httpserver.cpp +168 -0
- package/libs/wifi---esp32/login.full.html +37 -0
- package/libs/wifi---esp32/login.html +1 -0
- package/libs/wifi---esp32/pxt.json +1 -0
- package/libs/wifi---esp32/shims.d.ts +8 -0
- package/libs/wifi---esp32/sim/wifisockets.ts +3 -0
- package/libs/wifi---esp32/wifi.cpp +24 -15
- package/libs/wifi---esp32/wifi.h +15 -1
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
//%
|
|
4
|
-
//%
|
|
1
|
+
//% color="#95078E" weight=99 icon="\u2195" block="Sprite Scaling"
|
|
2
|
+
namespace scaling {
|
|
3
|
+
//% blockId=sprite_scale_to_percent_ex
|
|
4
|
+
//% block="set $sprite=variables_get(mySprite) scale to $value percent $direction anchor $anchor"
|
|
5
5
|
//% expandableArgumentMode=enabled
|
|
6
6
|
//% inlineInputMode=inline
|
|
7
|
-
//% value.defl=
|
|
7
|
+
//% value.defl=150
|
|
8
8
|
//% direction.defl=ScaleDirection.Uniformly
|
|
9
9
|
//% anchor.defl=ScaleAnchor.Middle
|
|
10
|
-
//% help=sprites/sprite-scaling/
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
//% help=sprites/sprite-scaling/scale
|
|
11
|
+
export function scaleToPercent(sprite: Sprite, value: number, direction?: ScaleDirection, anchor?: ScaleAnchor): void {
|
|
12
|
+
value /= 100;
|
|
13
13
|
direction = direction || ScaleDirection.Uniformly;
|
|
14
14
|
anchor = anchor || ScaleAnchor.Middle;
|
|
15
15
|
|
|
@@ -22,90 +22,91 @@ namespace sprites {
|
|
|
22
22
|
sprite.setScaleCore(sx, sy, anchor);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
//% blockId=
|
|
26
|
-
//% block="
|
|
27
|
-
//% advanced=true
|
|
25
|
+
//% blockId=sprite_scale_by_percent_ex
|
|
26
|
+
//% block="change $sprite=variables_get(mySprite) scale by $value percent $direction anchor $anchor"
|
|
28
27
|
//% expandableArgumentMode=enabled
|
|
29
28
|
//% inlineInputMode=inline
|
|
30
|
-
//%
|
|
29
|
+
//% value.defl=50
|
|
31
30
|
//% direction.defl=ScaleDirection.Uniformly
|
|
32
31
|
//% anchor.defl=ScaleAnchor.Middle
|
|
33
|
-
//% help=sprites/sprite-scaling/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
amount /= 100;
|
|
32
|
+
//% help=sprites/sprite-scaling/scale
|
|
33
|
+
export function scaleByPercent(sprite: Sprite, value: number, direction?: ScaleDirection, anchor?: ScaleAnchor): void {
|
|
34
|
+
value /= 100;
|
|
37
35
|
direction = direction || ScaleDirection.Uniformly;
|
|
38
36
|
anchor = anchor || ScaleAnchor.Middle;
|
|
39
37
|
|
|
40
38
|
let sx: number;
|
|
41
39
|
let sy: number;
|
|
42
40
|
|
|
43
|
-
if (direction & ScaleDirection.Horizontally) sx = sprite.sx +
|
|
44
|
-
if (direction & ScaleDirection.Vertically) sy = sprite.sy +
|
|
41
|
+
if (direction & ScaleDirection.Horizontally) sx = sprite.sx + value;
|
|
42
|
+
if (direction & ScaleDirection.Vertically) sy = sprite.sy + value;
|
|
45
43
|
|
|
46
44
|
sprite.setScaleCore(sx, sy, anchor);
|
|
47
45
|
}
|
|
48
46
|
|
|
49
|
-
//% blockId=
|
|
50
|
-
//% block="
|
|
51
|
-
//% advanced=true
|
|
47
|
+
//% blockId=sprite_scale_to_pixels_ex
|
|
48
|
+
//% block="set $sprite=variables_get(mySprite) scale to $value pixels $direction anchor $anchor || proportional $proportional"
|
|
52
49
|
//% expandableArgumentMode=enabled
|
|
53
50
|
//% inlineInputMode=inline
|
|
54
|
-
//%
|
|
55
|
-
//% direction.defl=ScaleDirection.Uniformly
|
|
56
|
-
//% anchor.defl=ScaleAnchor.Middle
|
|
57
|
-
//% help=sprites/sprite-scaling/shrink-by-percent
|
|
58
|
-
//% group="Scale" weight=70
|
|
59
|
-
export function shrinkByPercent(sprite: Sprite, amount: number, direction?: ScaleDirection, anchor?: ScaleAnchor): void {
|
|
60
|
-
growByPercent(sprite, -amount, direction, anchor);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
//% blockId=sprite_grow_by_pixels_ex
|
|
64
|
-
//% block="grow $sprite=variables_get(mySprite) by $amount pixels $direction || anchor $anchor proportional $proportional"
|
|
65
|
-
//% advanced=true
|
|
66
|
-
//% expandableArgumentMode=enabled
|
|
67
|
-
//% inlineInputMode=inline
|
|
68
|
-
//% amount.defl=10
|
|
51
|
+
//% value.defl=32
|
|
69
52
|
//% direction.defl=ScaleDirection.Horizontally
|
|
70
53
|
//% anchor.defl=ScaleAnchor.Middle
|
|
71
54
|
//% proportional.defl=0
|
|
72
|
-
//% help=sprites/sprite-scaling/
|
|
73
|
-
|
|
74
|
-
export function growByPixels(sprite: Sprite, amount: number, direction?: ScaleDirection, anchor?: ScaleAnchor, proportional?: boolean): void {
|
|
55
|
+
//% help=sprites/sprite-scaling/scale
|
|
56
|
+
export function scaleToPixels(sprite: Sprite, value: number, direction?: ScaleDirection, anchor?: ScaleAnchor, proportional?: boolean): void {
|
|
75
57
|
direction = direction || ScaleDirection.Horizontally;
|
|
76
58
|
anchor = anchor || ScaleAnchor.Middle;
|
|
77
|
-
|
|
59
|
+
|
|
60
|
+
if (proportional == null) proportional = direction === ScaleDirection.Uniformly;
|
|
78
61
|
|
|
79
62
|
let sx: number;
|
|
80
63
|
let sy: number;
|
|
81
64
|
|
|
82
65
|
if (direction & ScaleDirection.Horizontally) {
|
|
83
66
|
const imgW = sprite.image.width;
|
|
84
|
-
const newW =
|
|
67
|
+
const newW = value;
|
|
85
68
|
sx = newW / imgW;
|
|
86
69
|
}
|
|
87
70
|
|
|
88
71
|
if (direction & ScaleDirection.Vertically) {
|
|
89
72
|
const imgH = sprite.image.height;
|
|
90
|
-
const newH =
|
|
73
|
+
const newH = value;
|
|
91
74
|
sy = newH / imgH;
|
|
92
75
|
}
|
|
93
76
|
|
|
94
77
|
sprite.setScaleCore(sx, sy, anchor, proportional);
|
|
95
78
|
}
|
|
96
79
|
|
|
97
|
-
//% blockId=
|
|
98
|
-
//% block="
|
|
99
|
-
//% advanced=true
|
|
80
|
+
//% blockId=sprite_scale_by_pixels_ex
|
|
81
|
+
//% block="change $sprite=variables_get(mySprite) scale by $value pixels $direction anchor $anchor || proportional $proportional"
|
|
100
82
|
//% expandableArgumentMode=enabled
|
|
101
83
|
//% inlineInputMode=inline
|
|
102
|
-
//%
|
|
84
|
+
//% value.defl=10
|
|
103
85
|
//% direction.defl=ScaleDirection.Horizontally
|
|
104
86
|
//% anchor.defl=ScaleAnchor.Middle
|
|
105
87
|
//% proportional.defl=0
|
|
106
|
-
//% help=sprites/sprite-scaling/
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
88
|
+
//% help=sprites/sprite-scaling/scale
|
|
89
|
+
export function scaleByPixels(sprite: Sprite, value: number, direction?: ScaleDirection, anchor?: ScaleAnchor, proportional?: boolean): void {
|
|
90
|
+
direction = direction || ScaleDirection.Horizontally;
|
|
91
|
+
anchor = anchor || ScaleAnchor.Middle;
|
|
92
|
+
|
|
93
|
+
if (proportional == null) proportional = direction === ScaleDirection.Uniformly;
|
|
94
|
+
|
|
95
|
+
let sx: number;
|
|
96
|
+
let sy: number;
|
|
97
|
+
|
|
98
|
+
if (direction & ScaleDirection.Horizontally) {
|
|
99
|
+
const imgW = sprite.image.width;
|
|
100
|
+
const newW = sprite.width + value;
|
|
101
|
+
sx = newW / imgW;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (direction & ScaleDirection.Vertically) {
|
|
105
|
+
const imgH = sprite.image.height;
|
|
106
|
+
const newH = sprite.height + value;
|
|
107
|
+
sy = newH / imgH;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
sprite.setScaleCore(sx, sy, anchor, proportional);
|
|
110
111
|
}
|
|
111
112
|
}
|