pxt-arcade 1.10.26 → 1.10.28
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/sim.js +27 -14
- package/built/target.js +145 -144
- package/built/target.json +145 -144
- package/built/targetlight.json +5 -5
- package/built/theme.json +2 -1
- package/docs/hour-of-code-2022.html +96 -104
- package/docs/static/hour-of-code/2022/HoC_logo.png +0 -0
- package/docs/static/hour-of-code/2022/hoc_opengraph_large.png +0 -0
- package/docs/static/hour-of-code/2022/hoc_square.png +0 -0
- package/docs/static/hour-of-code/2022/styles.css +9 -61
- package/package.json +3 -3
- package/pxtarget.json +2 -1
package/built/sim.js
CHANGED
|
@@ -159,27 +159,15 @@ var pxsim;
|
|
|
159
159
|
setSimThemeColor("button-stroke", searchParams.get("button-stroke"));
|
|
160
160
|
setSimThemeColor("text-color", searchParams.get("text-color"));
|
|
161
161
|
setSimThemeColor("button-fill", searchParams.get("button-fill"));
|
|
162
|
+
setSimThemeColor("dpad-fill", searchParams.get("dpad-fill"));
|
|
162
163
|
if (!!searchParams.get("pointer-events"))
|
|
163
164
|
registerPointerEvents();
|
|
164
165
|
});
|
|
165
166
|
function registerPointerEvents() {
|
|
166
167
|
const canvas = document.getElementById("game-screen");
|
|
167
168
|
const encoder = new TextEncoder();
|
|
168
|
-
const
|
|
169
|
+
const sendMsg = (msg) => {
|
|
169
170
|
var _a;
|
|
170
|
-
// map canvas coordinates to arcade screen coordinates
|
|
171
|
-
const rect = canvas.getBoundingClientRect();
|
|
172
|
-
const x = ((event.clientX - rect.left) / rect.width) * 160;
|
|
173
|
-
const y = ((event.clientY - rect.top) / rect.height) * 120;
|
|
174
|
-
const msg = {
|
|
175
|
-
x,
|
|
176
|
-
y,
|
|
177
|
-
type: event.type,
|
|
178
|
-
pointerId: event.pointerId,
|
|
179
|
-
buttons: event.buttons,
|
|
180
|
-
pressure: event.pressure,
|
|
181
|
-
pointerType: event.pointerType,
|
|
182
|
-
};
|
|
183
171
|
const data = encoder.encode(JSON.stringify(msg));
|
|
184
172
|
const state = (_a = pxsim.board()) === null || _a === void 0 ? void 0 : _a.controlMessageState;
|
|
185
173
|
// queue in control sims
|
|
@@ -190,6 +178,30 @@ var pxsim;
|
|
|
190
178
|
data,
|
|
191
179
|
});
|
|
192
180
|
};
|
|
181
|
+
const reporter = (event) => {
|
|
182
|
+
event.preventDefault();
|
|
183
|
+
// map canvas coordinates to arcade screen coordinates
|
|
184
|
+
const rect = canvas.getBoundingClientRect();
|
|
185
|
+
const x = ((event.clientX - rect.left) / rect.width) * 160;
|
|
186
|
+
const y = ((event.clientY - rect.top) / rect.height) * 120;
|
|
187
|
+
sendMsg({
|
|
188
|
+
type: event.type,
|
|
189
|
+
pointerId: event.pointerId,
|
|
190
|
+
pointerType: event.pointerType,
|
|
191
|
+
x,
|
|
192
|
+
y,
|
|
193
|
+
buttons: event.buttons,
|
|
194
|
+
pressure: event.pressure,
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
const wheelReporter = (event) => {
|
|
198
|
+
sendMsg({
|
|
199
|
+
type: event.type,
|
|
200
|
+
dx: event.deltaX,
|
|
201
|
+
dy: event.deltaY,
|
|
202
|
+
dz: event.deltaZ,
|
|
203
|
+
});
|
|
204
|
+
};
|
|
193
205
|
canvas.addEventListener("pointerdown", reporter);
|
|
194
206
|
canvas.addEventListener("pointerup", reporter);
|
|
195
207
|
canvas.addEventListener("pointermove", reporter);
|
|
@@ -198,6 +210,7 @@ var pxsim;
|
|
|
198
210
|
canvas.addEventListener("pointercancel", reporter);
|
|
199
211
|
canvas.addEventListener("pointerover", reporter);
|
|
200
212
|
canvas.addEventListener("pointerout", reporter);
|
|
213
|
+
canvas.addEventListener("wheel", wheelReporter);
|
|
201
214
|
}
|
|
202
215
|
function setSimThemeColor(part, color) {
|
|
203
216
|
if (!part || !color || !/^[0-9A-F]{6}$/i.test(color))
|