pxt-common-packages 11.1.4 → 11.1.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.
- package/built/common-sim.d.ts +98 -0
- package/built/common-sim.js +343 -0
- package/libs/azureiot/built/debug/binary.js +461 -461
- package/libs/browser-events/browserEvents.cpp +29 -0
- package/libs/browser-events/browserEvents.ts +167 -0
- package/libs/browser-events/keyboard.ts +481 -0
- package/libs/browser-events/pxt.json +14 -0
- package/libs/browser-events/shims.d.ts +13 -0
- package/libs/browser-events/sim/browserEvent.ts +21 -0
- package/libs/browser-events/sim/keyboard.ts +256 -0
- package/libs/browser-events/sim/mouseState.ts +81 -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 +7608 -7582
- package/libs/controller---none/built/debug/binary.js +7587 -7561
- 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 +7500 -7474
- package/libs/game/camera.ts +2 -2
- package/libs/game/controller.ts +2 -2
- package/libs/game/docs/reference/animation/animation-frames.md +77 -0
- package/libs/game/docs/reference/images/image/equals.md +68 -0
- package/libs/game/docs/reference/images/image.md +65 -0
- package/libs/game/docs/reference/images/sprite-image.md +43 -0
- package/libs/game/docs/reference/info/change-countdown-by.md +26 -0
- package/libs/game/docs/reference/info/change-score-by.md +1 -1
- package/libs/game/docs/reference/info/countdown.md +52 -0
- package/libs/game/docs/reference/sprites/all-of-kind.md +71 -0
- package/libs/game/docs/reference/sprites/on-overlap.md +1 -1
- package/libs/game/game.ts +1 -1
- package/libs/game/info.ts +2 -2
- package/libs/game/spriteevents.ts +1 -1
- package/libs/game/sprites.ts +1 -1
- 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 +176 -176
- package/libs/net/built/debug/binary.js +176 -176
- package/libs/net-game/built/debug/binary.js +9348 -9322
- package/libs/palette/built/debug/binary.js +7499 -7473
- 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/screen/fieldeditors.ts +2 -0
- package/libs/screen/image.d.ts +1 -0
- package/libs/servo/built/debug/binary.js +8 -8
- package/libs/sprite-scaling/built/debug/binary.js +7499 -7473
- package/libs/storyboard/built/debug/binary.js +7499 -7473
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
namespace pxsim.browserEvents {
|
|
2
|
+
export function mouseX() {
|
|
3
|
+
return (pxsim.board() as BrowserEventsBoard).mouseState.mouseX();
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function mouseY() {
|
|
7
|
+
return (pxsim.board() as BrowserEventsBoard).mouseState.mouseY();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function wheelDx() {
|
|
11
|
+
return (pxsim.board() as BrowserEventsBoard).mouseState.wheelDx();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function wheelDy() {
|
|
15
|
+
return (pxsim.board() as BrowserEventsBoard).mouseState.wheelDy();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function wheelDz() {
|
|
19
|
+
return (pxsim.board() as BrowserEventsBoard).mouseState.wheelDz();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
namespace pxsim.browserEvents {
|
|
2
|
+
export enum Key {
|
|
3
|
+
Zero = 48,
|
|
4
|
+
One = 49,
|
|
5
|
+
Two = 50,
|
|
6
|
+
Three = 51,
|
|
7
|
+
Four = 52,
|
|
8
|
+
Five = 53,
|
|
9
|
+
Six = 54,
|
|
10
|
+
Seven = 55,
|
|
11
|
+
Eight = 56,
|
|
12
|
+
Nine = 57,
|
|
13
|
+
BackTick = 192,
|
|
14
|
+
Hyphen = 189,
|
|
15
|
+
Equals = 187,
|
|
16
|
+
Q = 81,
|
|
17
|
+
W = 87,
|
|
18
|
+
E = 69,
|
|
19
|
+
R = 82,
|
|
20
|
+
T = 84,
|
|
21
|
+
Y = 89,
|
|
22
|
+
U = 85,
|
|
23
|
+
I = 73,
|
|
24
|
+
O = 79,
|
|
25
|
+
P = 80,
|
|
26
|
+
OpenBracket = 219,
|
|
27
|
+
CloseBracket = 221,
|
|
28
|
+
BackSlash = 220,
|
|
29
|
+
A = 65,
|
|
30
|
+
S = 83,
|
|
31
|
+
D = 68,
|
|
32
|
+
F = 70,
|
|
33
|
+
G = 71,
|
|
34
|
+
H = 72,
|
|
35
|
+
Space = 32,
|
|
36
|
+
PageUp = 33,
|
|
37
|
+
J = 74,
|
|
38
|
+
K = 75,
|
|
39
|
+
L = 76,
|
|
40
|
+
SemiColon = 186,
|
|
41
|
+
Apostrophe = 222,
|
|
42
|
+
Z = 90,
|
|
43
|
+
X = 88,
|
|
44
|
+
C = 67,
|
|
45
|
+
V = 86,
|
|
46
|
+
B = 66,
|
|
47
|
+
N = 78,
|
|
48
|
+
M = 77,
|
|
49
|
+
Comma = 188,
|
|
50
|
+
Period = 190,
|
|
51
|
+
ForwardSlash = 191,
|
|
52
|
+
Shift = 16,
|
|
53
|
+
Enter = 13,
|
|
54
|
+
CapsLock = 20,
|
|
55
|
+
Tab = 9,
|
|
56
|
+
Control = 17,
|
|
57
|
+
Meta = 91,
|
|
58
|
+
Alt = 18,
|
|
59
|
+
ArrowUp = 38,
|
|
60
|
+
ArrowDown = 40,
|
|
61
|
+
ArrowLeft = 37,
|
|
62
|
+
ArrowRight = 39,
|
|
63
|
+
PageDown = 34,
|
|
64
|
+
End = 35,
|
|
65
|
+
Home = 36
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function onKeyboardEvent(event: KeyboardEvent, pressed: boolean) {
|
|
69
|
+
if (pressed) {
|
|
70
|
+
board().bus.queue(6866, getValueForKey(event));
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
board().bus.queue(6867, getValueForKey(event));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function getValueForKey(event: KeyboardEvent) {
|
|
78
|
+
switch (event.key) {
|
|
79
|
+
case "0":
|
|
80
|
+
case ")":
|
|
81
|
+
return Key.Zero;
|
|
82
|
+
case "1":
|
|
83
|
+
case "!":
|
|
84
|
+
return Key.One;
|
|
85
|
+
case "2":
|
|
86
|
+
case "@":
|
|
87
|
+
return Key.Two;
|
|
88
|
+
case "3":
|
|
89
|
+
case "#":
|
|
90
|
+
return Key.Three;
|
|
91
|
+
case "4":
|
|
92
|
+
case "$":
|
|
93
|
+
return Key.Four;
|
|
94
|
+
case "5":
|
|
95
|
+
case "%":
|
|
96
|
+
return Key.Five;
|
|
97
|
+
case "6":
|
|
98
|
+
case "^":
|
|
99
|
+
return Key.Six;
|
|
100
|
+
case "7":
|
|
101
|
+
case "&":
|
|
102
|
+
return Key.Seven;
|
|
103
|
+
case "8":
|
|
104
|
+
case "*":
|
|
105
|
+
return Key.Eight;
|
|
106
|
+
case "9":
|
|
107
|
+
case "(":
|
|
108
|
+
return Key.Nine;
|
|
109
|
+
case "`":
|
|
110
|
+
case "~":
|
|
111
|
+
return Key.BackTick;
|
|
112
|
+
case "-":
|
|
113
|
+
case "_":
|
|
114
|
+
return Key.Hyphen;
|
|
115
|
+
case "=":
|
|
116
|
+
case "+":
|
|
117
|
+
return Key.Equals;
|
|
118
|
+
case "Q":
|
|
119
|
+
case "q":
|
|
120
|
+
return Key.Q;
|
|
121
|
+
case "W":
|
|
122
|
+
case "w":
|
|
123
|
+
return Key.W;
|
|
124
|
+
case "E":
|
|
125
|
+
case "e":
|
|
126
|
+
return Key.E;
|
|
127
|
+
case "R":
|
|
128
|
+
case "r":
|
|
129
|
+
return Key.R;
|
|
130
|
+
case "T":
|
|
131
|
+
case "t":
|
|
132
|
+
return Key.T;
|
|
133
|
+
case "Y":
|
|
134
|
+
case "y":
|
|
135
|
+
return Key.Y;
|
|
136
|
+
case "U":
|
|
137
|
+
case "u":
|
|
138
|
+
return Key.U;
|
|
139
|
+
case "I":
|
|
140
|
+
case "i":
|
|
141
|
+
return Key.I;
|
|
142
|
+
case "O":
|
|
143
|
+
case "o":
|
|
144
|
+
return Key.O;
|
|
145
|
+
case "P":
|
|
146
|
+
case "p":
|
|
147
|
+
return Key.P;
|
|
148
|
+
case "[":
|
|
149
|
+
case "{":
|
|
150
|
+
return Key.OpenBracket;
|
|
151
|
+
case "]":
|
|
152
|
+
case "}":
|
|
153
|
+
return Key.CloseBracket;
|
|
154
|
+
case "\\":
|
|
155
|
+
case "|":
|
|
156
|
+
return Key.BackSlash;
|
|
157
|
+
case "A":
|
|
158
|
+
case "a":
|
|
159
|
+
return Key.A;
|
|
160
|
+
case "S":
|
|
161
|
+
case "s":
|
|
162
|
+
return Key.S;
|
|
163
|
+
case "D":
|
|
164
|
+
case "d":
|
|
165
|
+
return Key.D;
|
|
166
|
+
case "F":
|
|
167
|
+
case "f":
|
|
168
|
+
return Key.F;
|
|
169
|
+
case "G":
|
|
170
|
+
case "g":
|
|
171
|
+
return Key.G;
|
|
172
|
+
case "H":
|
|
173
|
+
case "h":
|
|
174
|
+
return Key.H;
|
|
175
|
+
case " ":
|
|
176
|
+
return Key.Space;
|
|
177
|
+
case "PageUp":
|
|
178
|
+
return Key.PageUp;
|
|
179
|
+
case "J":
|
|
180
|
+
case "j":
|
|
181
|
+
return Key.J;
|
|
182
|
+
case "K":
|
|
183
|
+
case "k":
|
|
184
|
+
return Key.K;
|
|
185
|
+
case "L":
|
|
186
|
+
case "l":
|
|
187
|
+
return Key.L;
|
|
188
|
+
case ";":
|
|
189
|
+
case ":":
|
|
190
|
+
return Key.SemiColon;
|
|
191
|
+
case "'":
|
|
192
|
+
case "\"":
|
|
193
|
+
return Key.Apostrophe;
|
|
194
|
+
case "Z":
|
|
195
|
+
case "z":
|
|
196
|
+
return Key.Z;
|
|
197
|
+
case "X":
|
|
198
|
+
case "x":
|
|
199
|
+
return Key.X;
|
|
200
|
+
case "C":
|
|
201
|
+
case "c":
|
|
202
|
+
return Key.C;
|
|
203
|
+
case "V":
|
|
204
|
+
case "v":
|
|
205
|
+
return Key.V;
|
|
206
|
+
case "B":
|
|
207
|
+
case "b":
|
|
208
|
+
return Key.B;
|
|
209
|
+
case "N":
|
|
210
|
+
case "n":
|
|
211
|
+
return Key.N;
|
|
212
|
+
case "M":
|
|
213
|
+
case "m":
|
|
214
|
+
return Key.M;
|
|
215
|
+
case ",":
|
|
216
|
+
case "<":
|
|
217
|
+
return Key.Comma;
|
|
218
|
+
case ".":
|
|
219
|
+
case ">":
|
|
220
|
+
return Key.Period;
|
|
221
|
+
case "/":
|
|
222
|
+
case "?":
|
|
223
|
+
return Key.ForwardSlash;
|
|
224
|
+
case "Shift":
|
|
225
|
+
return Key.Shift;
|
|
226
|
+
case "Enter":
|
|
227
|
+
return Key.Enter;
|
|
228
|
+
case "CapsLock":
|
|
229
|
+
return Key.CapsLock;
|
|
230
|
+
case "Tab":
|
|
231
|
+
return Key.Tab;
|
|
232
|
+
case "Control":
|
|
233
|
+
return Key.Control;
|
|
234
|
+
case "Meta":
|
|
235
|
+
return Key.Meta;
|
|
236
|
+
case "Alt":
|
|
237
|
+
return Key.Alt;
|
|
238
|
+
case "ArrowUp":
|
|
239
|
+
return Key.ArrowUp;
|
|
240
|
+
case "ArrowDown":
|
|
241
|
+
return Key.ArrowDown;
|
|
242
|
+
case "ArrowLeft":
|
|
243
|
+
return Key.ArrowLeft;
|
|
244
|
+
case "ArrowRight":
|
|
245
|
+
return Key.ArrowRight;
|
|
246
|
+
case "PageDown":
|
|
247
|
+
return Key.PageDown;
|
|
248
|
+
case "End":
|
|
249
|
+
return Key.End;
|
|
250
|
+
case "Home":
|
|
251
|
+
return Key.Home;
|
|
252
|
+
default:
|
|
253
|
+
return 0;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
namespace pxsim.browserEvents {
|
|
2
|
+
export interface BrowserEventsBoard extends CommonBoard {
|
|
3
|
+
mouseState: MouseState;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const THROTTLE_INTERVAL = 50;
|
|
7
|
+
|
|
8
|
+
export type MouseEvent = "pointerdown" | "pointerup" | "pointermove" | "pointerleave" | "pointerenter" | "pointercancel" | "pointerover" | "pointerout";
|
|
9
|
+
export class MouseState {
|
|
10
|
+
protected x: number;
|
|
11
|
+
protected y: number;
|
|
12
|
+
|
|
13
|
+
protected dx: number;
|
|
14
|
+
protected dy: number;
|
|
15
|
+
protected dz: number;
|
|
16
|
+
|
|
17
|
+
protected onMove = pxsim.U.throttle(() => {
|
|
18
|
+
board().bus.queue(
|
|
19
|
+
6859,
|
|
20
|
+
0
|
|
21
|
+
);
|
|
22
|
+
}, THROTTLE_INTERVAL, true);
|
|
23
|
+
|
|
24
|
+
protected onWheel = pxsim.U.throttle(() => {
|
|
25
|
+
board().bus.queue(
|
|
26
|
+
6865,
|
|
27
|
+
0
|
|
28
|
+
);
|
|
29
|
+
}, THROTTLE_INTERVAL, true);
|
|
30
|
+
|
|
31
|
+
onEvent(event: PointerEvent, x: number, y: number) {
|
|
32
|
+
this.x = x;
|
|
33
|
+
this.y = y;
|
|
34
|
+
|
|
35
|
+
const events = [
|
|
36
|
+
"pointerdown",
|
|
37
|
+
"pointerup",
|
|
38
|
+
"pointermove",
|
|
39
|
+
"pointerleave",
|
|
40
|
+
"pointerenter",
|
|
41
|
+
"pointercancel",
|
|
42
|
+
"pointerover",
|
|
43
|
+
"pointerout",
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
// We add 1 to the button here because the left button is 0 and
|
|
47
|
+
// that's used as a wildcard in our event bus
|
|
48
|
+
board().bus.queue(
|
|
49
|
+
6857 + events.indexOf(event.type),
|
|
50
|
+
(event.button || 0) + 1
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
onWheelEvent(dx: number, dy: number, dz: number) {
|
|
55
|
+
this.dx = dx;
|
|
56
|
+
this.dy = dy;
|
|
57
|
+
this.dz = dz;
|
|
58
|
+
this.onWheel();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
mouseX() {
|
|
62
|
+
return this.x || 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
mouseY() {
|
|
66
|
+
return this.y || 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
wheelDx() {
|
|
70
|
+
return this.dx || 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
wheelDy() {
|
|
74
|
+
return this.dy || 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
wheelDz() {
|
|
78
|
+
return this.dz || 0;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -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___P138589(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___138832 = (undefined);
|
|
70
|
+
globals._pollEventQueue___138845 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P138589.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"colorbuffer.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P138589.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P138589_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P138589, 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___P138541_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P138589
|
|
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___P97029(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___97272 = (undefined);
|
|
70
|
+
globals._pollEventQueue___97285 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P97029.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tcs34725.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P97029.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P97029_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P97029, 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___P96993_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P97029
|
|
92
92
|
})
|