pxt-common-packages 12.3.2 → 12.3.4
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 +4 -0
- package/built/common-sim.js +275 -0
- package/libs/azureiot/built/debug/binary.js +461 -461
- package/libs/base/configkeys.h +2 -0
- package/libs/base/pxtbase.h +12 -1
- package/libs/browser-events/browserEvents.ts +9 -9
- 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 +9969 -8494
- package/libs/controller---none/built/debug/binary.js +9948 -8473
- 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/_locales/game-strings.json +4 -0
- package/libs/game/built/debug/binary.js +9861 -8386
- package/libs/game/hitbox.ts +13 -9
- package/libs/game/pxt.json +1 -0
- package/libs/game/rotation.ts +194 -0
- package/libs/game/sprite.ts +102 -8
- package/libs/lcd/built/debug/binary.js +8 -8
- package/libs/light-spectrum-sensor/built/debug/binary.js +9 -9
- 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 +11768 -10293
- package/libs/palette/built/debug/binary.js +9860 -8385
- 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/image.cpp +374 -0
- package/libs/screen/image.ts +42 -0
- package/libs/screen/sim/image.ts +406 -0
- package/libs/servo/built/debug/binary.js +8 -8
- package/libs/settings/pxt.json +1 -0
- package/libs/settings/settings.cpp +21 -13
- package/libs/settings/targetoverrides.ts +6 -0
- package/libs/sprite-scaling/built/debug/binary.js +9860 -8385
- package/libs/storyboard/built/debug/binary.js +9860 -8385
- package/package.json +1 -1
package/libs/screen/sim/image.ts
CHANGED
|
@@ -933,6 +933,412 @@ namespace pxsim.ImageMethods {
|
|
|
933
933
|
}
|
|
934
934
|
return false;
|
|
935
935
|
}
|
|
936
|
+
|
|
937
|
+
const TWO_PI = 2 * Math.PI;
|
|
938
|
+
const HALF_PI = Math.PI / 2;
|
|
939
|
+
const THREE_HALF_PI = 3 * Math.PI / 2
|
|
940
|
+
|
|
941
|
+
const FX_ONE = 1;
|
|
942
|
+
|
|
943
|
+
function fxMul(a: number, b: number) {
|
|
944
|
+
return (a * b)
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
function fxDiv(a: number, b: number) {
|
|
948
|
+
return a / b;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
function fxToInt(v: number) {
|
|
952
|
+
return v
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
function fxFloor(v: number) {
|
|
956
|
+
return v | 0;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
interface ParsedShearArgs {
|
|
960
|
+
sx: number;
|
|
961
|
+
sy: number;
|
|
962
|
+
scaledWidth: number;
|
|
963
|
+
scaledHeight: number;
|
|
964
|
+
minX: number;
|
|
965
|
+
minY: number;
|
|
966
|
+
maxX: number;
|
|
967
|
+
maxY: number;
|
|
968
|
+
xShear: number;
|
|
969
|
+
yShear: number;
|
|
970
|
+
flip: boolean;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
function parseShearArgs(src: RefImage, args: RefCollection, argIndex: number): ParsedShearArgs {
|
|
974
|
+
const parsed: ParsedShearArgs = {
|
|
975
|
+
sx: 0,
|
|
976
|
+
sy: 0,
|
|
977
|
+
scaledWidth: 0,
|
|
978
|
+
scaledHeight: 0,
|
|
979
|
+
minX: 0,
|
|
980
|
+
minY: 0,
|
|
981
|
+
maxX: 0,
|
|
982
|
+
maxY: 0,
|
|
983
|
+
xShear: 0,
|
|
984
|
+
yShear: 0,
|
|
985
|
+
flip: false
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
const sx = ((args.getAt(argIndex) as number) * FX_ONE);
|
|
989
|
+
const sy = ((args.getAt(argIndex + 1) as number) * FX_ONE);
|
|
990
|
+
let angle = args.getAt(argIndex + 2) as number;
|
|
991
|
+
|
|
992
|
+
parsed.sx = sx;
|
|
993
|
+
parsed.sy = sy;
|
|
994
|
+
|
|
995
|
+
if (sx <= 0 || sy <= 0) {
|
|
996
|
+
return parsed;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
angle %= TWO_PI;
|
|
1000
|
+
if (angle < 0) {
|
|
1001
|
+
angle += TWO_PI;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
let flip = false;
|
|
1005
|
+
if (angle > HALF_PI && angle <= THREE_HALF_PI) {
|
|
1006
|
+
flip = true
|
|
1007
|
+
angle = (angle + Math.PI) % TWO_PI
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
const xShear = (-Math.tan(angle / 2) * FX_ONE);
|
|
1011
|
+
const yShear = (Math.sin(angle) * FX_ONE);
|
|
1012
|
+
|
|
1013
|
+
const scaledWidth = src._width * sx;
|
|
1014
|
+
const scaledHeight = src._height * sy;
|
|
1015
|
+
|
|
1016
|
+
let shearedX = 0;
|
|
1017
|
+
let shearedY = 0;
|
|
1018
|
+
|
|
1019
|
+
const SHEAR = (x: number, y: number) => {
|
|
1020
|
+
shearedX = fxFloor(x + fxMul(y, xShear));
|
|
1021
|
+
shearedY = fxFloor(y + fxMul(shearedX, yShear));
|
|
1022
|
+
shearedX = fxFloor(shearedX + fxMul(shearedY, xShear));
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
SHEAR(0, 0);
|
|
1026
|
+
let minX = shearedX;
|
|
1027
|
+
let minY = shearedY;
|
|
1028
|
+
let maxX = shearedX;
|
|
1029
|
+
let maxY = shearedY;
|
|
1030
|
+
|
|
1031
|
+
SHEAR(scaledWidth - FX_ONE, 0);
|
|
1032
|
+
minX = Math.min(minX, shearedX);
|
|
1033
|
+
minY = Math.min(minY, shearedY);
|
|
1034
|
+
maxX = Math.max(maxX, shearedX);
|
|
1035
|
+
maxY = Math.max(maxY, shearedY);
|
|
1036
|
+
|
|
1037
|
+
SHEAR(scaledWidth - FX_ONE, scaledHeight - FX_ONE);
|
|
1038
|
+
minX = Math.min(minX, shearedX);
|
|
1039
|
+
minY = Math.min(minY, shearedY);
|
|
1040
|
+
maxX = Math.max(maxX, shearedX);
|
|
1041
|
+
maxY = Math.max(maxY, shearedY);
|
|
1042
|
+
|
|
1043
|
+
SHEAR(0, scaledHeight - FX_ONE);
|
|
1044
|
+
minX = Math.min(minX, shearedX);
|
|
1045
|
+
minY = Math.min(minY, shearedY);
|
|
1046
|
+
maxX = Math.max(maxX, shearedX);
|
|
1047
|
+
maxY = Math.max(maxY, shearedY);
|
|
1048
|
+
|
|
1049
|
+
parsed.minX = minX;
|
|
1050
|
+
parsed.minY = minY;
|
|
1051
|
+
parsed.maxX = maxX;
|
|
1052
|
+
parsed.maxY = maxY;
|
|
1053
|
+
parsed.scaledWidth = scaledWidth;
|
|
1054
|
+
parsed.scaledHeight = scaledHeight;
|
|
1055
|
+
parsed.xShear = xShear;
|
|
1056
|
+
parsed.yShear = yShear;
|
|
1057
|
+
parsed.flip = flip;
|
|
1058
|
+
|
|
1059
|
+
return parsed;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
export function _drawScaledRotatedImage(dst: RefImage, src: RefImage, args: RefCollection) {
|
|
1063
|
+
drawScaledRotatedImage(dst, src, args);
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
export function drawScaledRotatedImage(dst: RefImage, src: RefImage, args: RefCollection) {
|
|
1067
|
+
const xDst = args.getAt(0) as number;
|
|
1068
|
+
const yDst = args.getAt(1) as number;
|
|
1069
|
+
if (xDst >= dst._width || yDst >= dst._height) {
|
|
1070
|
+
return;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
const shearArgs = parseShearArgs(src, args, 2);
|
|
1074
|
+
|
|
1075
|
+
if (
|
|
1076
|
+
shearArgs.sx <= 0 ||
|
|
1077
|
+
shearArgs.sy <= 0 ||
|
|
1078
|
+
xDst + fxToInt(shearArgs.maxX - shearArgs.minX) < 0 ||
|
|
1079
|
+
yDst + fxToInt(shearArgs.maxY - shearArgs.minY) < 0
|
|
1080
|
+
) {
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
let shearedX = 0;
|
|
1085
|
+
let shearedY = 0;
|
|
1086
|
+
|
|
1087
|
+
const SHEAR = (x: number, y: number) => {
|
|
1088
|
+
shearedX = fxFloor(x + fxMul(y, shearArgs.xShear));
|
|
1089
|
+
shearedY = fxFloor(y + fxMul(shearedX, shearArgs.yShear));
|
|
1090
|
+
shearedX = fxFloor(shearedX + fxMul(shearedY, shearArgs.xShear));
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
dst.makeWritable();
|
|
1094
|
+
|
|
1095
|
+
if (shearArgs.flip) {
|
|
1096
|
+
for (let y = 0; y < shearArgs.scaledHeight; y += FX_ONE) {
|
|
1097
|
+
for (let x = 0; x < shearArgs.scaledWidth; x += FX_ONE) {
|
|
1098
|
+
let color = getPixel(
|
|
1099
|
+
src,
|
|
1100
|
+
fxToInt(fxDiv((shearArgs.scaledWidth - x - FX_ONE), shearArgs.sx)),
|
|
1101
|
+
fxToInt(fxDiv((shearArgs.scaledHeight - y - FX_ONE), shearArgs.sy))
|
|
1102
|
+
);
|
|
1103
|
+
|
|
1104
|
+
if (!color) continue;
|
|
1105
|
+
|
|
1106
|
+
SHEAR(x, y);
|
|
1107
|
+
setPixel(dst, xDst + fxToInt(shearedX - shearArgs.minX), yDst + fxToInt(shearedY - shearArgs.minY), color);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
else {
|
|
1112
|
+
for (let y = 0; y < shearArgs.scaledHeight; y += FX_ONE) {
|
|
1113
|
+
for (let x = 0; x < shearArgs.scaledWidth; x += FX_ONE) {
|
|
1114
|
+
let color = getPixel(
|
|
1115
|
+
src,
|
|
1116
|
+
fxToInt(fxDiv(x, shearArgs.sx)),
|
|
1117
|
+
fxToInt(fxDiv(y, shearArgs.sy))
|
|
1118
|
+
);
|
|
1119
|
+
|
|
1120
|
+
if (!color) continue;
|
|
1121
|
+
|
|
1122
|
+
SHEAR(x, y);
|
|
1123
|
+
setPixel(dst, xDst + fxToInt(shearedX - shearArgs.minX), yDst + fxToInt(shearedY - shearArgs.minY), color);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
export function _checkOverlapsScaledRotatedImage(dst: RefImage, src: RefImage, args: RefCollection): boolean {
|
|
1130
|
+
const xDst = args.getAt(0) as number;
|
|
1131
|
+
const yDst = args.getAt(1) as number;
|
|
1132
|
+
if (xDst >= dst._width || yDst >= dst._height) {
|
|
1133
|
+
return false;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
const shearArgs = parseShearArgs(src, args, 2);
|
|
1137
|
+
|
|
1138
|
+
if (
|
|
1139
|
+
shearArgs.sx <= 0 ||
|
|
1140
|
+
shearArgs.sy <= 0 ||
|
|
1141
|
+
xDst + fxToInt(shearArgs.maxX - shearArgs.minX) < 0 ||
|
|
1142
|
+
yDst + fxToInt(shearArgs.maxY - shearArgs.minY) < 0
|
|
1143
|
+
) {
|
|
1144
|
+
return false;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
let shearedX = 0;
|
|
1148
|
+
let shearedY = 0;
|
|
1149
|
+
|
|
1150
|
+
const SHEAR = (x: number, y: number) => {
|
|
1151
|
+
shearedX = fxFloor(x + fxMul(y, shearArgs.xShear));
|
|
1152
|
+
shearedY = fxFloor(y + fxMul(shearedX, shearArgs.yShear));
|
|
1153
|
+
shearedX = fxFloor(shearedX + fxMul(shearedY, shearArgs.xShear));
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
if (shearArgs.flip) {
|
|
1158
|
+
for (let y = 0; y < shearArgs.scaledHeight; y += FX_ONE) {
|
|
1159
|
+
for (let x = 0; x < shearArgs.scaledWidth; x += FX_ONE) {
|
|
1160
|
+
let color = getPixel(
|
|
1161
|
+
src,
|
|
1162
|
+
fxToInt(fxDiv((shearArgs.scaledWidth - x - FX_ONE), shearArgs.sx)),
|
|
1163
|
+
fxToInt(fxDiv((shearArgs.scaledHeight - y - FX_ONE), shearArgs.sy))
|
|
1164
|
+
);
|
|
1165
|
+
|
|
1166
|
+
if (!color) continue;
|
|
1167
|
+
|
|
1168
|
+
SHEAR(x, y);
|
|
1169
|
+
if (getPixel(dst, xDst + fxToInt(shearedX - shearArgs.minX), yDst + fxToInt(shearedY - shearArgs.minY))) {
|
|
1170
|
+
return true;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
else {
|
|
1176
|
+
for (let y = 0; y < shearArgs.scaledHeight; y += FX_ONE) {
|
|
1177
|
+
for (let x = 0; x < shearArgs.scaledWidth; x += FX_ONE) {
|
|
1178
|
+
let color = getPixel(
|
|
1179
|
+
src,
|
|
1180
|
+
fxToInt(fxDiv(x, shearArgs.sx)),
|
|
1181
|
+
fxToInt(fxDiv(y, shearArgs.sy))
|
|
1182
|
+
);
|
|
1183
|
+
|
|
1184
|
+
if (!color) continue;
|
|
1185
|
+
|
|
1186
|
+
SHEAR(x, y);
|
|
1187
|
+
if (getPixel(dst, xDst + fxToInt(shearedX - shearArgs.minX), yDst + fxToInt(shearedY - shearArgs.minY))) {
|
|
1188
|
+
return true;
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
return false;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
export function _checkOverlapsTwoScaledRotatedImages(dst: RefImage, src: RefImage, args: RefCollection): boolean {
|
|
1198
|
+
const xDst = args.getAt(0) as number;
|
|
1199
|
+
const yDst = args.getAt(1) as number;
|
|
1200
|
+
const dstArgs = parseShearArgs(dst, args, 2);
|
|
1201
|
+
|
|
1202
|
+
if (
|
|
1203
|
+
dstArgs.sx <= 0 ||
|
|
1204
|
+
dstArgs.sy <= 0 ||
|
|
1205
|
+
xDst >= dstArgs.maxX - dstArgs.minX ||
|
|
1206
|
+
yDst >= dstArgs.maxY - dstArgs.minY
|
|
1207
|
+
) {
|
|
1208
|
+
return false;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
const srcArgs = parseShearArgs(src, args, 5);
|
|
1212
|
+
|
|
1213
|
+
if (
|
|
1214
|
+
srcArgs.sx <= 0 ||
|
|
1215
|
+
srcArgs.sy <= 0 ||
|
|
1216
|
+
xDst + srcArgs.maxX - srcArgs.minX < 0 ||
|
|
1217
|
+
yDst + srcArgs.maxY - srcArgs.minY < 0
|
|
1218
|
+
) {
|
|
1219
|
+
return false;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
let shearedX = 0;
|
|
1223
|
+
let shearedY = 0;
|
|
1224
|
+
let unshearedX = 0;
|
|
1225
|
+
let unshearedY = 0;
|
|
1226
|
+
|
|
1227
|
+
const SHEAR = (x: number, y: number, xShear: number, yShear: number) => {
|
|
1228
|
+
shearedX = fxFloor(x + fxMul(y, xShear));
|
|
1229
|
+
shearedY = fxFloor(y + fxMul(shearedX, yShear));
|
|
1230
|
+
shearedX = fxFloor(shearedX + fxMul(shearedY, xShear));
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
const REVERSE_SHEAR = (x: number, y: number, xShear: number, yShear: number) => {
|
|
1234
|
+
unshearedX = fxFloor(x - fxMul(y, xShear));
|
|
1235
|
+
unshearedY = fxFloor(y - fxMul(unshearedX, yShear));
|
|
1236
|
+
unshearedX = fxFloor(unshearedX - fxMul(unshearedY, xShear));
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
if (srcArgs.flip) {
|
|
1240
|
+
for (let y = 0; y < srcArgs.scaledHeight; y += FX_ONE) {
|
|
1241
|
+
for (let x = 0; x < srcArgs.scaledWidth; x += FX_ONE) {
|
|
1242
|
+
let color = getPixel(
|
|
1243
|
+
src,
|
|
1244
|
+
fxToInt(fxDiv((srcArgs.scaledWidth - x - FX_ONE), srcArgs.sx)),
|
|
1245
|
+
fxToInt(fxDiv((srcArgs.scaledHeight - y - FX_ONE), srcArgs.sy))
|
|
1246
|
+
);
|
|
1247
|
+
|
|
1248
|
+
if (!color) continue;
|
|
1249
|
+
|
|
1250
|
+
SHEAR(x, y, srcArgs.xShear, srcArgs.yShear);
|
|
1251
|
+
|
|
1252
|
+
const screenX = xDst + shearedX - srcArgs.minX;
|
|
1253
|
+
const screenY = yDst + shearedY - srcArgs.minY;
|
|
1254
|
+
|
|
1255
|
+
if (
|
|
1256
|
+
screenX < 0 ||
|
|
1257
|
+
screenY < 0 ||
|
|
1258
|
+
screenX >= dstArgs.maxX - dstArgs.minX ||
|
|
1259
|
+
screenY >= dstArgs.maxY - dstArgs.minY
|
|
1260
|
+
) {
|
|
1261
|
+
continue;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
REVERSE_SHEAR(screenX + dstArgs.minX, screenY + dstArgs.minY, dstArgs.xShear, dstArgs.yShear);
|
|
1265
|
+
|
|
1266
|
+
if (dstArgs.flip) {
|
|
1267
|
+
if (
|
|
1268
|
+
getPixel(
|
|
1269
|
+
dst,
|
|
1270
|
+
fxToInt(fxDiv(dstArgs.scaledWidth - unshearedX - FX_ONE, dstArgs.sx)),
|
|
1271
|
+
fxToInt(fxDiv(dstArgs.scaledHeight - unshearedY - FX_ONE, dstArgs.sy))
|
|
1272
|
+
)
|
|
1273
|
+
) {
|
|
1274
|
+
return true;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
else if (
|
|
1278
|
+
getPixel(
|
|
1279
|
+
dst,
|
|
1280
|
+
fxToInt(fxDiv(unshearedX, dstArgs.sx)),
|
|
1281
|
+
fxToInt(fxDiv(unshearedY, dstArgs.sy))
|
|
1282
|
+
)
|
|
1283
|
+
) {
|
|
1284
|
+
return true;
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
else {
|
|
1290
|
+
for (let y = 0; y < srcArgs.scaledHeight; y += FX_ONE) {
|
|
1291
|
+
for (let x = 0; x < srcArgs.scaledWidth; x += FX_ONE) {
|
|
1292
|
+
let color = getPixel(
|
|
1293
|
+
src,
|
|
1294
|
+
fxToInt(fxDiv(x, srcArgs.sx)),
|
|
1295
|
+
fxToInt(fxDiv(y, srcArgs.sy))
|
|
1296
|
+
);
|
|
1297
|
+
|
|
1298
|
+
if (!color) continue;
|
|
1299
|
+
|
|
1300
|
+
SHEAR(x, y, srcArgs.xShear, srcArgs.yShear);
|
|
1301
|
+
|
|
1302
|
+
const screenX = xDst + shearedX - srcArgs.minX;
|
|
1303
|
+
const screenY = yDst + shearedY - srcArgs.minY;
|
|
1304
|
+
|
|
1305
|
+
if (
|
|
1306
|
+
screenX < 0 ||
|
|
1307
|
+
screenY < 0 ||
|
|
1308
|
+
screenX >= dstArgs.maxX - dstArgs.minX ||
|
|
1309
|
+
screenY >= dstArgs.maxY - dstArgs.minY
|
|
1310
|
+
) {
|
|
1311
|
+
continue;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
REVERSE_SHEAR(screenX + dstArgs.minX, screenY + dstArgs.minY, dstArgs.xShear, dstArgs.yShear);
|
|
1315
|
+
|
|
1316
|
+
if (dstArgs.flip) {
|
|
1317
|
+
if (
|
|
1318
|
+
getPixel(
|
|
1319
|
+
dst,
|
|
1320
|
+
fxToInt(fxDiv(dstArgs.scaledWidth - unshearedX - FX_ONE, dstArgs.sx)),
|
|
1321
|
+
fxToInt(fxDiv(dstArgs.scaledHeight - unshearedY - FX_ONE, dstArgs.sy))
|
|
1322
|
+
)
|
|
1323
|
+
) {
|
|
1324
|
+
return true;
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
else if (
|
|
1328
|
+
getPixel(
|
|
1329
|
+
dst,
|
|
1330
|
+
fxToInt(fxDiv(unshearedX, dstArgs.sx)),
|
|
1331
|
+
fxToInt(fxDiv(unshearedY, dstArgs.sy))
|
|
1332
|
+
)
|
|
1333
|
+
) {
|
|
1334
|
+
return true;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
return false;
|
|
1341
|
+
}
|
|
936
1342
|
}
|
|
937
1343
|
|
|
938
1344
|
|
|
@@ -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___P53420(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___53663 = (undefined);
|
|
70
|
+
globals._pollEventQueue___53676 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P53420.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"targetoverrides.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P53420.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P53420_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P53420, 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___P52723_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P53420
|
|
92
92
|
})
|
package/libs/settings/pxt.json
CHANGED
|
@@ -20,29 +20,26 @@ class WStorage {
|
|
|
20
20
|
FS fs;
|
|
21
21
|
bool isMounted;
|
|
22
22
|
|
|
23
|
-
WStorage()
|
|
23
|
+
WStorage(uint32_t size)
|
|
24
24
|
: flash(),
|
|
25
25
|
#if defined(STM32F4)
|
|
26
|
-
fs(flash, 0x8008000,
|
|
26
|
+
fs(flash, 0x8008000, size),
|
|
27
27
|
#elif defined(SAMD51)
|
|
28
|
-
fs(flash, 512 * 1024 -
|
|
28
|
+
fs(flash, 512 * 1024 - size, size),
|
|
29
29
|
#elif defined(SAMD21)
|
|
30
|
-
fs(flash, 256 * 1024 -
|
|
30
|
+
fs(flash, 256 * 1024 - size, size),
|
|
31
31
|
#elif defined(MICROBIT_CODAL) && MICROBIT_CODAL
|
|
32
|
-
|
|
33
|
-
// https://github.com/lancaster-university/codal-microbit-v2/blob/master/docs/MemoryMap.md
|
|
34
|
-
// 73000 CODAL scratch page (is used as temporary scratch by MicroBitFlash, MicroBitFileSystem and MicroBitStorage)
|
|
35
|
-
fs(flash, 0x73000 - SETTINGS_SIZE, SETTINGS_SIZE),
|
|
32
|
+
fs(flash, MICROBIT_TOP_OF_FLASH - size, size),
|
|
36
33
|
#elif defined(NRF52_SERIES)
|
|
37
34
|
#define NRF_BOOTLOADER_START *(uint32_t *)0x10001014
|
|
38
35
|
fs(flash,
|
|
39
36
|
128 * 1024 < NRF_BOOTLOADER_START && NRF_BOOTLOADER_START < (uint32_t)flash.totalSize()
|
|
40
|
-
? NRF_BOOTLOADER_START -
|
|
41
|
-
: flash.totalSize() -
|
|
42
|
-
|
|
37
|
+
? NRF_BOOTLOADER_START - size
|
|
38
|
+
: flash.totalSize() - size,
|
|
39
|
+
size),
|
|
43
40
|
#elif defined(PICO_BOARD)
|
|
44
41
|
// XIP bias 0x10000000
|
|
45
|
-
fs(flash, 0x10000000 + flash.totalSize() -
|
|
42
|
+
fs(flash, 0x10000000 + flash.totalSize() - size - 4096, size),
|
|
46
43
|
#else
|
|
47
44
|
fs(flash),
|
|
48
45
|
#endif
|
|
@@ -50,7 +47,18 @@ class WStorage {
|
|
|
50
47
|
fs.minGCSpacing = 10000;
|
|
51
48
|
}
|
|
52
49
|
};
|
|
53
|
-
|
|
50
|
+
|
|
51
|
+
static WStorage *instWStorage;
|
|
52
|
+
WStorage *getWStorage() {
|
|
53
|
+
if (!instWStorage) {
|
|
54
|
+
uint32_t size = getConfig(CFG_SETTINGS_SIZE_DEFL, SETTINGS_SIZE);
|
|
55
|
+
uint32_t new_size = getConfig(CFG_SETTINGS_SIZE, 0);
|
|
56
|
+
if (new_size > 0)
|
|
57
|
+
size = new_size;
|
|
58
|
+
instWStorage = new WStorage(size);
|
|
59
|
+
}
|
|
60
|
+
return instWStorage;
|
|
61
|
+
}
|
|
54
62
|
|
|
55
63
|
static WStorage *mountedStorage() {
|
|
56
64
|
auto s = getWStorage();
|