-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.ts
More file actions
44 lines (39 loc) · 1.25 KB
/
Copy pathtest.ts
File metadata and controls
44 lines (39 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// tests go here; this will not be compiled when this package is used as an extension.
let paused = 0;
controller.anyButton.onEvent(ControllerButtonEvent.Pressed, () => {
if (!controller.menu.isPressed()) return;
paused = 1 - paused;
})
game.stats = true;
let pics = [
assets.image`pic0`,
assets.image`pic1`,
assets.image`pic2`,
assets.image`pic3`,
assets.image`pic4`,
assets.image`pic5`,
assets.image`pic6`,
assets.image`pic7`,
];
let bpals = [
image.BayerSize.x4, 8,
image.BayerSize.x8, 4,
image.BayerSize.x16, 1,
];
let r = randint(0, pics.length - 1), cr = r;
let pic = pics[r], t = 0, bpi = Math.imul(randint(0, 2), 2)
, bpal = bpals[bpi]; bpi = bpals[bpi + 1], t = 0;
forever(() => {
switch (paused) {
case 0:
if ((t & 0xff) > ((t + bpi) & 0xff)) {
scene.backgroundImage().drawBayerImage(pic, 0, 0, 0xff, bpal);
pause(512);
while (r === cr) r = randint(0, pics.length - 1);
cr = r; bpi = Math.imul(randint(0, 2), 2);
bpal = bpals[bpi]; bpi = bpals[bpi + 1]; t = 0;
pic = pics[cr];
} else scene.backgroundImage().drawBayerImage(pic, 0, 0, t, bpal), t += bpi;
}
})
// end test