-
Notifications
You must be signed in to change notification settings - Fork 1
/
splash.ts
54 lines (52 loc) · 1.62 KB
/
splash.ts
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
45
46
47
48
49
50
51
52
53
54
// Add your code here
let snake = `
f f f f c c c c c c f f f f f f
f f f c 6 7 7 7 7 6 c f f f f f
f f c 7 7 7 7 7 7 7 7 c f f f f
f c 6 7 7 7 7 7 7 7 7 6 c f f f
f c 7 c 6 6 6 6 c 7 7 7 c f f f
f f 7 6 f 6 6 f 6 7 7 7 f f f f
f f 7 7 7 7 7 7 7 7 7 7 f f f f
f f f 7 7 7 7 6 c 7 7 6 f c f f
f f f f c c c c 7 7 6 f 7 7 c f
f f c 7 2 7 7 7 6 c f 7 7 7 7 c
f c 7 7 2 7 7 c f c 6 7 7 6 c c
c 1 1 1 1 7 6 f c c 6 6 6 c f f
f 1 1 1 1 1 6 6 c 6 6 6 6 f f f
f 6 1 1 1 1 1 6 6 6 6 6 c f f f
f f 6 1 1 1 1 1 1 6 6 6 f f f f
f f c c c c c c c c c f f f f f
`
const blocks = `
f f f f f f f f f f f f f f f f
f f f f f 5 5 f f f f f f f f f
f f f f f 5 5 f f f f f f f f f
f 9 9 f f 5 5 5 5 5 5 f f f f f
f 9 9 f f 5 5 5 5 5 5 f f f f f
f 9 9 f f f f f f f f f f f f f
f 9 9 f f f f f f f f f f f f f
f 9 9 f f c c f f 7 7 7 7 f f f
f 9 9 f f c c f f 7 7 7 7 f f f
f 9 9 f f f f f f f f 7 7 7 7 f
f 9 9 f f f f f f f f 7 7 7 7 f
f f f f f 3 3 f f f f f f f f f
f f f f f 3 3 f f f f f f f f f
f f f 3 3 3 3 3 3 f f f f f f f
f f f 3 3 3 3 3 3 f f f f f f f
f f f f f f f f f f f f f f f f
`
function drawImage(img: string) {
let c = 0, r= 0;
for(let i=0; i<img.length; i++) {
let dot = img[i] == "."
let hex = "01234567890abcdef".includes(img[i])
if (dot || hex) {
if (hex) {
let colIndex = img.charCodeAt(i) - "0".charCodeAt(0);
screen.setPixel(c, r, toRGB(colIndex));
}
c++; if (c==16) { c = 0; r++}
}
}
screen.show();
}